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 only
one predictor. The outcome variable is constant. The changing variable
should be named vox
in the input formula.
bigLMStats2(dataFrame, voxmat, myFormula)
dataFrame | This data frame contains all relevant predictors except for
the matrix associated with the changing variable, heretofore named |
---|---|
voxmat | The matrix that contains the changing predictor named |
myFormula | This is a character string that defines a valid regression formula. |
A list of different matrices that contain names derived from the formula and the coefficients of the regression model.
set.seed(1500) nsub = 100 outcome = rnorm( nsub ) covar = rnorm( nsub ) mat = replicate( nsub, rnorm( nsub ) ) myform = " outcome ~ covar + vox " df = data.frame( outcome = outcome, covar = covar ) result = bigLMStats2( df, mat, myform) print( names( result ) )#> [1] "estimate" "stdError" "tValue" "pValue"print( rownames( result$pValue ) )#> [1] "(Intercept)" "covar" "vox"