lmPBJ | R Documentation |
This function computes a statistical map and residuals which are the objects necessary to perform the parametric bootstrap joint (PBJ) inference procedure.
lmPBJ(
images,
form,
formred = ~1,
mask,
id = NULL,
data = NULL,
W = NULL,
Winv = NULL,
template = NULL,
formImages = NULL,
robust = TRUE,
transform = c("t", "none", "f", "edgeworth"),
outdir = NULL,
zeros = FALSE,
HC3 = TRUE,
mc.cores = getOption("mc.cores", 2L)
)
images |
Character vector of subject images to be modeled as an outcome variable OR 4d array of imaging data OR 4d nifti object. |
form |
formula or character that can be coerced to a formula or a design matrix for the full model. |
formred |
formula or character that can be coerced to a formula or a design matrix for reduced model. If robust=TRUE then this must have one less column than X. |
mask |
File name for a binary mask file or niftiImage object. |
id |
Vector to identify measurements from the same observation. |
data |
R data frame containing variables in form. If form and formred are matrices then this can be NULL. |
W |
Numeric vector of weights for regression model. Can be used to deweight noisy observations. Same as what should be passed to lm. |
Winv |
Inverse weights for regression model. Inverse of W. |
template |
Template image used for visualization. |
formImages |
n X p matrix of images where n is the number of subjects and each column corresponds to an imaging covariate. Currently, not supported. |
robust |
Logical, compute robust standard error estimates? |
transform |
character indicating type of transformation to use. "none", "t", "f", or "edgeworth" are currently accepted. Edgeworth is slow. |
outdir |
If specified, output is saved as NIfTIs and statMap object is saved as strings. This approach conserves memory, but has longer IO time. Currently, not supported. |
zeros |
Exclude voxels that have zeros? Zeros may exist due to differences in masking and coverage or they may represent locations where the data took the value zero. |
HC3 |
Logical, Uses HC3 SE estimates from Long and Ervin 2000? Defaults to TRUE. |
mc.cores |
Argument passed to mclapply for parallel things. |
Returns a list with the following values:
The statistical values where mask!=0. It is a chi^2-statistic map.
A 4d niftiImage giving the parameter estimates for covariates only in the full model.
The covariance object used to sample from the joint distribution of the statistical image.
The input mask.
The background template used for visualization.
A list containing the full and reduced models.
# loading example data
library(pain21)
pain = pain21()
pdata = pain$data
# fitting intercept only model, weights proportional to study sample size
pbjModel1 = lmPBJ(images=pdata$images, form=~1, formred=~0, W = pdata$n,
mask=pain$mask, data=pdata, template = pain$template)
pbjModel1
# image(pbjModel1, index=5:15, nrow=2)
# image(pbjModel1)
# par(mfrow=c(1,2))
# image(pbjModel1, title='Pain Analysis', oma=c(0,0,3,0), crop=TRUE, index=2, lo=FALSE)
# image(pbjModel1, oma=c(0,0,3,0), crop=FALSE, index=2, lo=FALSE)
# image(stat.statMap(pbjModel1), title='Pain Analysis', oma=c(0,0,3,0), crop=FALSE, index=45)
# fitting regression of images onto study sample size, weights proportional to study sample size
pbjModel2 = lmPBJ(images=pdata$images, form=~n, formred=~1, W = pdata$n, mask=pain$mask, data=pdata)
pbjModel2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.