Skip to contents

This function performs a linear mixed model analysis using lmer.

Usage

get_model_and_data(
  data,
  condition_column,
  experimental_columns,
  response_column,
  total_column = NULL,
  condition_is_categorical,
  covariate = NULL,
  crossed_columns = NULL,
  error_is_non_normal = FALSE,
  family_p = NULL,
  na.action = "complete",
  include_interaction = FALSE,
  random_slope_variable = NULL,
  covariate_is_categorical = TRUE
)

Arguments

data

Input data

condition_column

Name of the condition variable (ex variable with values such as control/case). The input file has to have a corresponding column name

experimental_columns

Name of variables related to experimental design such as "experiment", "plate", and "cell_line". They should be in order, for example, "experiment" should always come first .

response_column

Name of the variable observed by performing the experiment. ex) intensity.

total_column

Set this column only when family_p="binomial" and it is equal to the total number of observations (number of cases plus number of controls) for a given number of cases

condition_is_categorical

Specify whether the condition variable is categorical. TRUE: Categorical, FALSE: Continuous.

covariate

The name of the covariate to control in the regression model

crossed_columns

Name of experimental variables that may appear repeatedly with the same ID. For example, cell_line C1 may appear in multiple experiments, but plate P1 cannot appear in more than one experiment

error_is_non_normal

Default: the observed variable is continuous Categorical response variable will be implemented in the future. TRUE: Categorical , FALSE: Continuous (default).

family_p

The type of distribution family to specify when the response is categorical. If family is "binary" then binary(link="log") is used, if family is "poisson" then poisson(link="logit") is used, if family is "poisson_log" then poisson(link=") log") is used.

na.action

"complete": missing data is not allowed in all columns (default), "unique": missing data is not allowed only in condition, experimental, and response columns. Selecting "complete" removes an entire row when there is one or more missing values, which may affect the distribution of other features.

include_interaction

Whether to include condition * covariate interaction

random_slope_variable

Variable for random slopes (typically "condition_column")

covariate_is_categorical

Specify whether the covariate variable is categorical. TRUE: Categorical, FALSE: Continuous.

Value

A list of the linear mixed model result, original data, experimental column names, and residual values