Learn R Programming

brainGraph (version 0.72.0)

SPM: Perform between-group tests at each vertex for a given vertex measure

Description

This function takes a list of igraph graphs and performs either a linear model, 2-sample t-test, or 2-sample Wilcoxon test at each vertex for a given vertex measure (e.g. degree).

Usage

SPM(g, measure, outcome = measure, test = c("lm", "t.test", "wilcox.test"), alternative = c("two.sided", "less", "greater"), covars = NULL, permute = FALSE, N = 5000, alpha = 0.05)

Arguments

g
A list of igraph graph objects for all subjects (if you have multiple groups, you must concatenate the separate group lists)
measure
A character string of the vertex measure of interest
outcome
A character string of the name of the outcome variable; by default, it is ignored
test
A character string for the test to use, either 'lm', 't.test', or 'wilcox.test' (default: 'lm')
alternative
Character string, whether to do a two- or one-sided test (default: 'two.sided')
covars
A data.table of covariates; needed if using lm (default: NULL)
permute
Logical indicating whether or not to permute group labels (default: FALSE)
N
Integer; number of permutations to create (default: 5e3)
alpha
Numeric; the significance level (default: 0.05)

Value

A list containing: A list containing:

Details

You will need to provide a data.table of covariates, of which Study.ID and Group need to be column names. Additionally, all graphs must have a name attribute (at the graph level) which matches the Study.ID for a given subject. If you do not provide covariates, the code will pull group membership from the graphs' Group graph attributes and do a test of group differences. This function will then return the p-value, t-statistic, and parameter estimate associated with the Group covariate.

If you would like to test whether a vertex attribute is associated with a different outcome variable (for example, betweenness centrality and full-scale IQ), then specify the relevant outcome variable in the function call, and provide the data in the covariates table. This currently only works for single-group data.

You may optionally do permutation testing by permuting the labels for subject group. This is the same principle as that of Nichols & Holmes (2001) used in voxelwise MRI analyses and implemented in FSL's randomise.

References

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

Examples

Run this code
## Not run: 
# g.diffs.btwn <- SPM(g=c(g.norm[[1]][[1]], g.norm[[2]][[1]]),
#   measure='btwn.cent', test='wilcox.test')
# g.diffs.btwn <- SPM(g=c(g[[1]][[5]], g[[2]][[5]]),
#   measure='btwn.cent', test='lm', covars=covars.dti)
# g.corrs.btwn.IQ <- SPM(g=g2, measure='btwn.cent', outcome='IQ', test='lm',
#   covars=cbind(covars.dti, IQ))
# ## End(Not run)

Run the code above in your browser using DataLab