get_residuals_covariate
get_residuals.Rd
This function retrieve residual values from an lmerFit summary object and plot residual values by condition_column
Note: The current version does not accept categorical response variables, sample size parameters smaller than the observed samples size
Usage
get_residuals(
data,
condition_column,
experimental_columns,
response_column,
condition_is_categorical,
covariate = NULL,
crossed_columns = NULL,
total_column = FALSE,
error_is_non_normal = FALSE,
family_p = NULL,
na.action = "complete",
include_interaction = FALSE,
random_slope_variable = NULL,
covariate_is_categorical = TRUE,
print_plots = 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.
- 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
- 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
- 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.
- print_plots
Whether or not to print the plots, irrespective of this argument ggplot versions of evaluated association between the response_column and the condition_column. TRUE - print the plot, FALSE - do not print the plot
Value
A list with 3 elements. 1. The updated input data with an additional column with the model residuals of the individual observations. 2. A plot representing the purported association between the response column and the condition column. 3. The corresponding caption for this figure.
Examples
result=get_residuals_covariate(data=RMeDPower_data1,
condition_column="classification",
experimental_columns=c("experiment", "line"),
response_column="cell_size1",
condition_is_categorical=TRUE,
covariate="covariate",
crossed_columns = "line",
error_is_non_normal=FALSE)
#> Error in get_residuals_covariate(data = RMeDPower_data1, condition_column = "classification", experimental_columns = c("experiment", "line"), response_column = "cell_size1", condition_is_categorical = TRUE, covariate = "covariate", crossed_columns = "line", error_is_non_normal = FALSE): could not find function "get_residuals_covariate"