Region of Interest Based MVPA Analysis
run_regional.Rd
Run a separate MVPA analysis for multiple disjoint regions of interest.
Value
A named list containing:
- performance
Performance metrics for each region
- prediction_table
Predictions for each region
- fits
Model fits if return_fits=TRUE
Examples
# \donttest{
# Generate sample dataset (3D volume with categorical response)
dataset <- gen_sample_dataset(
D = c(10,10,10), # Small 10x10x10 volume
nobs = 100, # 100 observations
nlevels = 3, # 3 classes
response_type = "categorical",
data_mode = "image",
blocks = 3 # 3 blocks for cross-validation
)
# Create region mask with 5 ROIs
region_mask <- NeuroVol(
sample(1:5, size=length(dataset$dataset$mask), replace=TRUE),
space(dataset$dataset$mask)
)
#> Error in NeuroVol(sample(1:5, size = length(dataset$dataset$mask), replace = TRUE), space(dataset$dataset$mask)): could not find function "NeuroVol"
# Create cross-validation specification
cval <- blocked_cross_validation(dataset$design$block_var)
# Load SDA classifier (Shrinkage Discriminant Analysis)
model <- load_model("sda_notune")
# Create MVPA model
mspec <- mvpa_model(
model = model,
dataset = dataset$dataset,
design = dataset$design,
model_type = "classification",
crossval = cval,
return_fits = TRUE # Return fitted models
)
# Run regional analysis
results <- run_regional(mspec, region_mask)
#> Error: object 'region_mask' not found
# Access results
head(results$performance) # Performance metrics
#> Error: object 'results' not found
head(results$prediction_table) # Predictions
#> Error: object 'results' not found
first_roi_fit <- results$fits[[1]] # First ROI's fitted model
#> Error: object 'results' not found
# }