ilr.predict.Rd
This function computes a prediction given ilr
output.
ilr.predict(ilrResult, dataFrame, voxmats, myFormula)
This output form ilr
This data frame contains all relevant predictors except for the matrices associated with the image variables.
The named list of matrices that contains the changing predictors.
This is a character string that defines a valid regression formula.
the predicted matrix.
set.seed(1500)
nsub <- 100
trte <- sample(1:nsub)[1:70]
covarIn <- rnorm(nsub)
mat <- replicate(nsub, rnorm(nsub))
mat2 <- replicate(nsub, rnorm(nsub))
outcomeAtVox <- mat[, 2]
# also try myform = " vox ~ covar + vox2 "
myform <- "outcome ~ covar + vox + vox2"
df <- data.frame(outcome = outcomeAtVox, covar = covarIn)
result <- ilr(df[trte, ], list(vox = mat[trte, ], vox2 = mat2[trte, ]), myform)
df2 <- data.frame(covar = covarIn[-trte])
pred <- ilr.predict(result, df2, list(vox = mat[-trte, ], vox2 = mat2[-trte, ]), myform)
max(cor(pred, outcomeAtVox[-trte]))
#> [1] 1