Learn R Programming

brainGraph (version 2.7.3)

GLM: Fit linear models at each vertex of a graph

Description

brainGraph_GLM specifies and fits a linear model at each vertex for a given vertex measure (e.g. degree) or at the graph-level (e.g., global efficiency). Given a contrast matrix, it will calculate the associated statistics.

The summary method prints the results, only for which \(p < \alpha\); you may change this to the FDR-adjusted or permutation p-values via the function argument p.sig.

The plot method plots the GLM diagnostics (similar to that of plot.lm). There are a total of 6 possible plots, specified by the which argument; the behavior is the same as in plot.lm. Please see the help for that function.

Usage

brainGraph_GLM(g.list, covars, measure, con.mat, con.type = c("t", "f"),
  X = NULL, con.name = NULL, alternative = c("two.sided", "less",
  "greater"), alpha = 0.05, level = c("vertex", "graph"),
  permute = FALSE, N = 5000, perms = NULL, long = FALSE, ...)

# S3 method for bg_GLM summary(object, p.sig = c("p", "p.fdr", "p.perm"), contrast = NULL, digits = max(3L, getOption("digits") - 2L), print.head = TRUE, ...)

# S3 method for bg_GLM plot(x, region = NULL, which = c(1L:3L, 5L), ...)

Arguments

g.list

A list of igraph graph objects for all subjects

covars

A data.table of covariates

measure

Character string of the graph measure of interest

con.mat

Numeric matrix specifying the contrast(s) of interest; if only one contrast is desired, you can supply a vector

con.type

Character string; either 't' or 'f' (for t or F-statistics). Default: 't'

X

Numeric matrix, if you wish to supply your own design matrix (default: NULL)

con.name

Character vector of the contrast name(s); if con.mat has row names, those will be used for reporting results (default: NULL)

alternative

Character string, whether to do a two- or one-sided test (default: 'two.sided')

alpha

Numeric; the significance level (default: 0.05)

level

Character string; either vertex (default) or graph

permute

Logical indicating whether or not to permute group labels (default: FALSE)

N

Integer; number of permutations to create (default: 5e3)

perms

Matrix of permutations, if you would like to provide your own (default: NULL)

long

Logical indicating whether or not to return all permutation results (default: FALSE)

...

Other arguments passed to brainGraph_GLM_design

object

A bg_GLM object

p.sig

Character string specifying which p-value to use for displaying significant results (default: p)

contrast

Integer specifying the contrast to plot/summarize; defaults to showing results for all contrasts

digits

Integer specifying the number of digits to display for p-values

print.head

Logical indicating whether or not to print only the first and last 5 rows of the statistics tables (default: TRUE)

x

A bg_GLM object

region

Character string specifying which region's results to plot; only relevant if level='vertex' (default: NULL)

which

Integer vector indicating which of the 6 plots to print to the plot device (default: c(1:3, 5))

Value

An object of class bg_GLM containing some input-specific variables, in addition to:

X

A numeric matrix; a copy of the design matrix

y

A numeric vector or matrix of the outcome variable

DT

A data table with an entry for each vertex (region) containing statistics of interest

removed

A character vector of Study.ID's removed due to incomplete data (if any)

perm

A list containing: null.dist (the null distribution of maximum statistics), thresh (the statistic value corresponding to the \(100 \times (1 - \alpha)\)th% percentile of the null distribution)

The plot method returns a list of ggplot objects

Details

The input list of graphs g.list must not be nested; i.e., if you have multiple groups, they will have to be combined into one list. See the code in the Examples below.

A data.table of covariates is required input; the first column must be named Study.ID. Additionally, all graphs must have a name attribute (at the graph level) which matches the Study.ID for a given subject. If you create the design matrix X yourself, you still must supply the covariates table so that subjects can be correctly matched with their network data.

Both t- and F-contrasts are allowed. You may supply a matrix to the argument con.mat. If you supply a multi-row matrix and you choose con.type="t", then statistics will be calculated for each contrast individually. If you choose con.type="f", in the result data table, ESS stands for "extra sum of squares", the additional variance explained for by the model parameters of interest (as determined by the contrast matrix). Finally, the standard error in these tables is the sum of squared errors of the full model.

Finally, you can calculate permutations of the data to build a null distribution of the maximum statistic, to provide control over false positives. The permutation strategy is that of Freedman & Lane (1983), and is the same as that in FSL's randomise.

References

Freedman D & Lane D (1983). A nonstochastic interpretation of reported significance levels. J Bus Econ Stat, 1(4):292-298.

Nichols TE & Holmes AP (2001). Nonparametric permutation tests for functional neuroimaging: A primer with examples. Human Brain Mapping, 15(1):1-25.

Winkler AM, Ridgway GR, Webster MA, Smith SM, Nichols TE (2014). Permutation inference for the general linear model. NeuroImage, 92:381-397.

See Also

plot.lm

Other GLM functions: GLMdesign, GLMfit, mtpc

Other Group analysis functions: Bootstrapping, IndividualContributions, MediationAnalysis, NBS, brainGraph_permute, mtpc

Examples

Run this code
# NOT RUN {
conmat <- matrix(c(0, 0, 0, 1), nrow=1)
rownames(conmat) <- 'Control > Patient'

## Note that I concatenate the graphs from each group's 6th threshold
g.lm <- brainGraph_GLM(g.list=do.call(Map, c(c, g))[[6]],
  covars=covars.all[tract == 1],
  measure='strength', con.mat=conmat, alt='greater',
  permute=TRUE, long=TRUE)
# }
# NOT RUN {
## Save objects and then to multipage PDF
lmPlots <- plot(x)
ggsave('lmPlots.pdf', lmPlots)

## Save all the GLM sub-objects from MTPC analysis
res.mtpc <- mtpc(...)
glmPlots <- lapply(res.mtpc$res.glm, plot, which=1:6)
ml <- marrangeGrob(glmPlots, nrow=1, ncol=1)
ggsave('glmPlots.pdf', ml, width=8.5, height=11)
# }

Run the code above in your browser using DataLab