Skip to contents

A function to regress out the effect a confounding variable on a dependent variable.

Usage

regEff(data, ..., d.var, c.var)

Arguments

data

A data frame output from any easyXpress function used after the modelSelection function.

...

<[rlang::`dyn-dots`]> Variable(s) used to group the data prior to regression. Variable names can be listed in succession. For example, drug.

d.var

The dependent variable to use in the linear model. Supply the variable without quotes. For example, median_wormlength_um_delta.

c.var

The confounding variable to use in the linear model. Supply the variable without quotes. For example, bleach.

Value

A list including four elements. 1) A data frame, <out>$d, with three variables added. These include, <d.var>_reg, <c.var>_reg_coeff, and <c.var>_reg_sig. 2) A diagnostic plot, <out>$p1, showing the effect of the confounding variable (c.var) on the dependent variable (d.var). 3) A diagnositc plot, <out>$p2, showing the regression coefficients of the confounding variable (c.var) on the y-axis and the dependent variable (d.var) on the x-axis. 4) A list, <out>$models of model objects for each group.