cvEigenanatomy: Cross-validation method for eigenanatomy decompositions.

View source: R/cvEigenanatomy.R

cvEigenanatomyR Documentation

Cross-validation method for eigenanatomy decompositions.

Description

Perform cross-validation on an image set using eigencomponents to predict an outcome variable.

Usage

cvEigenanatomy(
  demog,
  images,
  outcome,
  ratio = 10,
  mask = NULL,
  sparseness = 0.01,
  nvecs = 50,
  its = 5,
  cthresh = 250,
  ...
)

Arguments

demog

Demographics information that includes outcome and (optional) covariates.

images

n by p input image matrix, where n is the number of subjects and p is the number of voxels.

outcome

Name of outcome variable. Must be present in demog.

ratio

If greater than 1, number of folds for cross-validation. If less than 1, one testing-training step will be performed, using ratio of the data for training and the rest for testing.

mask

Mask image of type antsImage.

sparseness

Desired level of sparsity in decomposition.

nvecs

Number of eigenvectors to use in decomposition.

its

Number of iterations for decomposition.

cthresh

Cluster threshold for decomposition.

...

Additional options passed to regressProjections.

Value

A result, or (if ratio > 1) list of results, from regressProjection.

Author(s)

Kandel BM and Avants B

Examples

## Not run: 
# generate simulated outcome
nsubjects <- 100
x1 <- seq(1, 10, length.out = nsubjects) + rnorm(nsubjects, sd = 2)
x2 <- seq(25, 15, length.out = nsubjects) + rnorm(nsubjects, sd = 2)
outcome <- 3 * x1 + 4 * x2 + rnorm(nsubjects, sd = 1)
# generate simulated images with outcome predicted
# by sparse subset of voxels
voxel.1 <- 3 * x1 + rnorm(nsubjects, sd = 2)
voxel.2 <- rnorm(nsubjects, sd = 2)
voxel.3 <- 2 * x2 + rnorm(nsubjects, sd = 2)
voxel.4 <- rnorm(nsubjects, sd = 3)
input <- cbind(voxel.1, voxel.2, voxel.3, voxel.4)
mask <- as.antsImage(matrix(c(1, 1, 1, 1), nrow = 2))
# generate sample demographics that do not explain outcome
age <- runif(nsubjects, 50, 75)
demog <- data.frame(outcome = outcome, age = age)
result <- cvEigenanatomy(demog, input, "outcome",
  ratio = 5, mask,
  sparseness = 0.25, nvecs = 4
)

## End(Not run)


stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.