This function is able to generate all the necessary files to run randomise with a GAM Model This script will write out all design and contrast files This function will run a f-test to compare a full and reduced model (a model with and without spline)
gamRandomise(image, maskPath = NULL, formulaFull, formulaRed, subjData,
outDir, nsim = 500, thresh = 0.01, run = FALSE)Input path of 'nifti' image or vector of path(s) to images. If multiple paths, the script will all mergeNiftis() and merge across time.
to mask. Must be a binary mask
Must be the formula of the full model (i.e. "~s(age,k=5)+sex+mprage_antsCT_vol_TBV")
Must be the formula of the reduced model (i.e. "~sex+mprage_antsCT_vol_TBV")
Dataframe containing all the covariates used for the analysis
output directory for randomise
Number of simulations
significance threshold
FALSE will only print randomise command but won't it
Return randomise command
if (FALSE) { # \dontrun{
subjData = mgcv::gamSim(1,n=400,dist="normal",scale=2)
OutDirRoot="Output Directory"
maskName="Path to mask"
imagePath="Path to output"
covsFormula="~s(age,k=5)+sex+mprage_antsCT_vol_TBV"
redFormula="~sex+mprage_antsCT_vol_TBV"
gamRandomise(image = imagePath, maskPath = maskName, formulaFull = covsFormula,
formulaRed = redFormula, subjData = subjData, outDir = OutDirRoot)
} # }