This function computes a prediction or low-dimensional embedding, given milr output. It will return a predictive model if the outcome variable is a scalar. Otherwise, it will return a low-dimensional embedding without a specific predictive model.

milr.predict(
  milrResult,
  dataFrameTrain,
  voxmatsTrain,
  dataFrameTest,
  voxmatsTest,
  myFormula
)

Arguments

milrResult

This output form milr

dataFrameTrain

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

voxmatsTrain

The named list of matrices that contains the changing predictors.

dataFrameTest

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

voxmatsTest

The named list of matrices that contains the changing predictors in test data.

myFormula

This is a character string that defines a valid regression formula.

Value

the predicted matrix.

See also

Author

BB Avants.

Examples


nsub <- 24
npix <- 100
outcome <- rnorm(nsub)
covar <- rnorm(nsub)
mat <- replicate(npix, rnorm(nsub))
mat2 <- replicate(npix, rnorm(nsub))
mat3 <- replicate(npix, rnorm(nsub))
myform <- " vox2 ~ covar + vox + vox3 "
istr <- c(rep(TRUE, round(nsub * 2 / 3)), rep(FALSE, nsub - round(nsub * 2 / 3)))
df <- data.frame(outcome = outcome, covar = covar)
ltr <- list(vox = mat[istr, ], vox2 = mat2[istr, ], vox3 = mat3[istr, ])
lte <- list(vox = mat[!istr, ], vox2 = mat2[!istr, ], vox3 = mat3[!istr, ])
result <- milr(df[istr, ], ltr, myform)
pred <- milr.predict(result, df[istr, ], ltr, df[!istr, ], lte, myform)