Example using voxel-wise statistics in R. Functional code using logistic regression and prediction on new data from fitted model. The code works, but the predictions are not very good.
Prepare the csv file with the file file path to the free water and wmh files.
df <- run_logistic()
Fit logistic model using these commands:
pval_file <- "pvals.nii.gz"
beta_file <- "betas.nii.gz"
mask_file <- "mask.nii.gz"
voxel_logistic <- function(df,pval_file, beta_file, mask_file)
The fitted model is represented by the beta image betas.nii.gz
.
pred_file <- "predicted.nii.gz"
voxel_predict <- function(df, beta_file,pred_file,mask_file, thr = 0.5)