Learn R Programming

brainGraph (version 1.0.0)

brainGraph_GLM_design: Create a design matrix for linear model analysis

Description

This function takes a data.table of covariates and returns a design matrix to be used in linear model analysis.

Usage

brainGraph_GLM_design(covars, coding = c("dummy", "effects", "cell.means"),
  mean.center = FALSE, binarize = NULL, int = NULL)

Arguments

covars
A data.table of covariates
coding
Character string indicating how factor variables will be coded (default: 'dummy')
mean.center
Logical indicating whether to mean center non-factor variables (default: FALSE)
binarize
Character string specifying the column name(s) of the covariate(s) to be converted from type factor to numeric (default: NULL)
int
Character string specifying the column name(s) of the covariate(s) to test for an interaction (default: NULL)

Value

A numeric matrix

Details

There are three different ways to code factors: dummy, effects, or cell-means (chosen by the argument coding). To understand the difference, see Chapter 7 of the User Guide. The argument mean.center allows you to mean-center any non-factor variables (including dummy/indicator covariates). The argument binarize will turn given factor variables into dummy/indicator variables. The int argument specifies which variables should interact with the Group factor variable. This argument accepts either numeric variables (e.g., Age) and other factor variables (e.g., Sex) if you are running a two-way ANOVA. See Chapter 7 of the User Guide for examples.

See Also

Other GLM functions: brainGraph_GLM_fit, brainGraph_GLM