Learn R Programming

brainGraph (version 2.7.3)

Residuals: Linear model residuals in structural covariance networks

Description

get.resid runs linear models across brain regions listed in a data.table (e.g. cortical thickness), adjusting for variables in covars (e.g. age, sex, etc.), and calculates the externally Studentized (or leave-one-out) residuals.

The [ method will let you reorder or subset residuals based on a given numeric vector. However, this is used in bootstrap and permutation analysis and should generally not be called directly by the user.

The summary method prints the number of outliers per region, and the number of times a given subject was an outlier (i.e., across regions).

The plot method lets you check the model residuals for each brain region in a structural covariance analysis. It shows a qqplot of the studentized residuals, as output from get.resid.

Usage

get.resid(dt.vol, covars, method = c("comb.groups", "sep.groups"),
  use.mean = FALSE, exclude.cov = NULL, ...)

# S3 method for brainGraph_resids [(x, i, g = NULL)

# S3 method for brainGraph_resids summary(object, regions = NULL, ...)

# S3 method for brainGraph_resids plot(x, regions = NULL, cols = FALSE, ...)

Arguments

dt.vol

A data.table containing all the volumetric measure of interest (i.e., the object lhrh as ouptut by import_scn)

covars

A data.table of the covariates of interest

method

Character string indicating whether to test models for subject groups separately or combined (default: comb.groups)

use.mean

Logical should we control for the mean hemispheric brain value (e.g. mean LH/RH cortical thickness) (default: FALSE)

exclude.cov

Character vector of covariates to exclude (default: NULL)

...

Arguments passed to brainGraph_GLM_design (optional)

x

A brainGraph_resids object

i

Numeric vector of the indices

g

Character string indicating the group (default: NULL)

object

A brainGraph_resids object

regions

Character vector of region(s) to focus on; default behavior is to show summary for all regions

cols

Logical indicating whether to color by group (default: FALSE)

Value

get.resid - an object of class brainGraph_resids with elements:

X

The design matrix

method

The input argument method

use.mean

The input argument use.mean

all.dat.tidy

The tidied data.table of volumetric data (e.g., mean regional cortical thickness) and covariates, along with resids column added

resids.all

The "wide" data.table of residuals

groups

Group names

summary.brainGraph_resids returns a list with two data tables, one of the residuals, and one of only the outlier regions

The plot method returns a list of ggplot objects

Details

You can choose to run models for each of your subject groups separately or combined (the default) via the method argument. You may also choose whether or not to include the mean, per-hemisphere structural measure in the models. Finally, you can specify variables that are present in covars but you would like to exclude from the models.

See Also

rstudent

qqnorm

Other Structural covariance network functions: Bootstrapping, IndividualContributions, brainGraph_permute, corr.matrix, import_scn, plot_volumetric

Examples

Run this code
# NOT RUN {
myresids <- get.resids(lhrh, covars)
residPlots <- plot(myresids, cols=TRUE)

## Save as a multi-page PDF
ml <- marrangeGrob(residPlots, nrow=3, ncol=3)
ggsave('residuals.pdf', ml)
# }

Run the code above in your browser using DataLab