Residuals {brainGraph} | R Documentation |
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 reorders or subsets 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, atlas = NULL, ...)
## S3 method for class 'brainGraph_resids'
x[i, g = NULL]
## S3 method for class 'brainGraph_resids'
summary(object, region = NULL,
outlier.thresh = 2, ...)
## S3 method for class 'brainGraph_resids'
plot(x, region = NULL, outlier.thresh = 2,
cols = FALSE, ids = TRUE, ...)
## S3 method for class 'brainGraph_resids'
nobs(object, ...)
## S3 method for class 'brainGraph_resids'
case.names(object, ...)
## S3 method for class 'brainGraph_resids'
groups(x)
## S3 method for class 'brainGraph_resids'
region.names(object)
## S3 method for class 'brainGraph_resids'
nregions(object)
Arguments
dt.vol |
A |
covars |
A |
method |
Character string indicating whether to test models for subject
groups separately or combined. Default: |
use.mean |
Logical should we control for the mean hemispheric brain
value (e.g. mean LH/RH cortical thickness). Default: |
exclude.cov |
Character vector of covariates to exclude. Default:
|
atlas |
Character string indicating the brain atlas |
... |
Arguments passed to |
x , object |
A |
i |
Numeric vector of the indices |
g |
Character string indicating the group. Default: |
region |
Character vector of region(s) to focus on; default behavior is to show summary for all regions |
outlier.thresh |
Number indicating how many standard deviations
above/below the mean indicate an outlier. Default: |
cols |
Logical indicating whether to color by group. Default:
|
ids |
Logical indicating whether to plot subject ID's for outliers. Otherwise plots the integer index |
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 to include the mean, per-hemisphere structural measure in the
models. Finally, you can specify variables that are present in covars
which you would like to exclude from the models. Optional arguments can be
provided that get passed to brainGraph_GLM_design
.
If you do not explicitly specify the atlas name, then it will be guessed from the size of your data. This could cause problems if you are using a custom atlas, with or without the same number of regions as a dataset in the package.
Value
get.resid
- an object of class brainGraph_resids
with
elements:
data |
A data.table with the input volume/thickness/etc. data as well as the covariates used in creating the design matrix. |
X |
The design matrix, if using default arguments. If
|
method |
The input argument |
use.mean |
The input argument |
resids.all |
The “wide” |
Group |
Group names |
atlas |
The atlas name |
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 trellis
object or a list of
ggplot
objects
Note
It is assumed that dt.vol
was created using
import_scn
. In older versions, there were issues when the Study
ID was specified as an integer and was not “zero-padded”. This is done
automatically by import_scn
, so if you are using an external
program, please be sure that the Study ID column is matched in both
dt.vol
and covars
.
Author(s)
Christopher G. Watson, cgwatson@bu.edu
See Also
Other Structural covariance network functions: Bootstrapping
,
IndividualContributions
,
brainGraph_permute
,
corr.matrix
, import_scn
,
plot_volumetric
Examples
## 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)
## End(Not run)