This function simplifies calculating image-wide multivariate PCA maps. The model will minimize a matrix energy similar to norm( X - UVt - UranVrant ) where the U are standard design and random effect (intercept) design matrices. The random intercept matrix is only included if repeated measures are indicated.

mild(
  dataFrame,
  voxmats,
  basisK,
  myFormulaK,
  smoothingMatrix,
  iterations = 10,
  gamma = 1e-06,
  sparsenessQuantile = 0.5,
  positivity = c("positive", "negative", "either"),
  initializationStrategy = 0,
  repeatedMeasures = NA,
  orthogonalize = FALSE,
  verbose = FALSE
)

Arguments

dataFrame

This data frame contains all relevant predictors except for the matrices associated with the image variables.

voxmats

The named list of matrices that contains the changing predictors.

basisK

an integer determining the size of the basis.

myFormulaK

This is a character string that defines a valid regression which in this case should include predictors named as paste0("mildBasis",1:basisK)

smoothingMatrix

allows parameter smoothing, should be square and same size as input matrix

iterations

number of gradient descent iterations

gamma

step size for gradient descent

sparsenessQuantile

quantile to control sparseness - higher is sparser

positivity

restrict to positive or negative solution (beta) weights. choices are positive, negative or either as expressed as a string.

initializationStrategy

optional initialization matrix or seed. seed should be a single number; matrix should be a n by k matrix.

repeatedMeasures

list of repeated measurement identifiers. this will allow estimates of per identifier intercept.

orthogonalize

boolean to control whether we orthogonalize the v

verbose

boolean to control verbosity of output

Value

A list of different matrices that contain names derived from the formula and the coefficients of the regression model.

See also

Author

BB Avants.

Examples


set.seed(1500)
nsub <- 12
npix <- 100
outcome <- rnorm(nsub)
covar <- rnorm(nsub)
mat <- replicate(npix, rnorm(nsub))
mat2 <- replicate(npix, rnorm(nsub))
nk <- 3
myform <- paste(
  " vox2 ~ covar + vox + ",
  paste0("mildBasis", 1:nk, collapse = "+")
) # optional covariates
df <- data.frame(outcome = outcome, covar = covar)
result <- mild(df, list(vox = mat, vox2 = mat2),
  basisK = 3, myform,
  initializationStrategy = 10
)
result <- mild(df, list(vox = mat, vox2 = mat2),
  basisK = 3, myform,
  initializationStrategy = 4
)
myumat <- svd(mat2, nv = 0, nu = 3)$u
result <- mild(df, list(vox = mat, vox2 = mat2),
  basisK = 3, myform,
  initializationStrategy = 0
)