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, mask, data = NULL, W = NULL,
  Winv = NULL, template = NULL, formImages = NULL, robust = TRUE,
  sqrtSigma = TRUE, transform = TRUE, outdir = NULL,
  mc.cores = getOption("mc.cores", 2L))

Arguments

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.

data

R data frame containing variables in form. If form and formred are matrices then this can be NULL.

W

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. Required when passing variance images as the inverse weights.

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? Defaults to TRUE. Uses HC3 SE estimates from Long and Ervin 2000.

sqrtSigma

Logical: return V X n matrix sqrtSigma? Defaults to TRUE (described below). Required to use pbj function.

transform

Logical: use transformation from equation (5) of Vandekar et al. 2019 (Biometrics)? Defaults to TRUE. (instead of niftiImage objects; defaults to FALSE).

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.

mc.cores

Argument passed to mclapply for parallel things.

Value

Returns a list with the following values:

stat

The statistical values where mask!=0. If ncol(X) = ncol(Xred)+1, then this is a Z-statistic map, otherwise it is a chi^2-statistic map.

coef

A 4d niftiImage giving the parameter estimates for covariates only in the full model.

sqrtSigma

The covariance object. This is a V by n matrix R, such that R %*% t(R) = hatSigma.

mask

The input mask.

template

The background template used for visualization.

formulas

A list containing the full and reduced models.

robust

A logical indicating the input setting.

df

The numerator degrees of freedom of the test.

rdf

The numerator degrees of freedom of the test.

stat=stat, sqrtSigma=res, mask=mask, template=template, formulas=list(form, formred), robust=robust, df=df, rdf=rdf