Learn R Programming

brainGraph (version 1.0.0)

get.resid: Linear model residuals across brain regions

Description

This function runs linear models across brain regions listed in a data.table (e.g. cortical thickness), in order to adjust for relevant variables (e.g. age, sex, group, etc.). It adds the studentized residuals as a column and returns the data table.

Usage

get.resid(tidy.dt, covars, use.mean = FALSE, exclude = NULL)

Arguments

tidy.dt
A data.table that has been "tidied", containing all covariates and the brain measure of interest
covars
A data.table of covariates
use.mean
A logical indicating whether to control for the mean hemispheric brain value (e.g. mean LH/RH cortical thickness) (default: NULL)
exclude
A character vector of columns to exclude (default: NULL)

Value

A list with components:
all.dat.tidy
The tidied data.table with 'resids' column added
formulas
Character string of the lm formulas used
resids.all
The "wide" data.table of residuals

See Also

rstudent