This function simplifies calculating p-values from linear models in which there is a similar formula that is applied many times with a change in image-based predictors. Image-based variables are stored in the input matrix list. They should be named consistently in the input formula and in the image list. If they are not, an error will be thrown. All input matrices should have the same number of rows and columns.

ilr(dataFrame, voxmats, myFormula)

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.

myFormula

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

Value

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

Author

BB Avants.

Examples


set.seed(1500)
nsub <- 100
outcome <- rnorm(nsub)
covar <- rnorm(nsub)
mat <- replicate(nsub, rnorm(nsub))
mat2 <- replicate(nsub, rnorm(nsub))
myform <- " outcome ~ covar + vox "
df <- data.frame(outcome = outcome, covar = covar)
result <- ilr(df, list(vox = mat), myform)
print(names(result))
#> [1] "estimate"    "stdError"    "tValue"      "pValue"      "predictions"
#> [6] "modelMatrix"
print(rownames(result$pValue))
#> [1] "(Intercept)" "covar"       "vox"        
myform <- " vox2 ~ covar + vox "
df <- data.frame(outcome = outcome, covar = covar)
result <- ilr(df, list(vox = mat, vox2 = mat2), myform)
print(names(result))
#> [1] "estimate"    "stdError"    "tValue"      "pValue"      "predictions"
#> [6] "modelMatrix"
print(rownames(result$pValue))
#> [1] "(Intercept)" "covar"       "vox"