Learn R Programming

ANTsR (version 0.3.3)

sparseDecomboot: Convenience wrapper for eigenanatomy decomposition.

Description

Decomposes a matrix into sparse eigenevectors to maximize explained variance.

Usage

sparseDecomboot(inmatrix = NA, inmask = NA, sparseness = 0.01, nvecs = 50, its = 5, cthresh = 250, z = 0, smooth = 0, initializationList = list(), mycoption = 0, nboot = 10, nsamp = 0.9, robust = 0, doseg = TRUE)

Arguments

inmatrix
n by p input images , subjects or time points by row , spatial variable lies along columns
inmask
optional antsImage mask
sparseness
lower values equal more sparse
nvecs
number of vectors
its
number of iterations
cthresh
cluster threshold
z
u penalty, experimental
smooth
smoothness eg 0.5
initializationList
see initializeEigenanatomy
mycoption
0, 1 or 2 all produce different output 0 is combination of 1 (spatial orthogonality) and 2 (subject space orthogonality)
nboot
boostrap integer e.g. 10 equals 10 boostraps
nsamp
value less than or equal to 1, e.g. 0.9 means 90 percent of data will be used in each boostrap resampling
robust
boolean
doseg
orthogonalize bootstrap results

Examples

Run this code

mat<-replicate(100, rnorm(20))
mydecom<-sparseDecomboot( mat, nboot=5, nsamp=0.9, nvecs=2 )

## Not run: 
# # for prediction
# if ( usePkg("randomForest") & usePkg("spls") ) {
# data(lymphoma)
# training<-sample( rep(c(TRUE,FALSE),31)  )
# sp<-0.001 ; myz<-0 ; nv<-5
# ldd<-sparseDecomboot( lymphoma$x[training,], nvecs=nv ,
#   sparseness=( sp ), mycoption=1, z=myz , nsamp=0.9, nboot=50 ) # NMF style
# outmat<-as.matrix(ldd$eigenanatomyimages )
# # outmat<-t(ldd$cca1outAuto)
# traindf<-data.frame( lclass=as.factor(lymphoma$y[ training  ]),
#   eig = lymphoma$x[training,]  %*% t(outmat) )
# testdf<-data.frame(  lclass=as.factor(lymphoma$y[ !training ]),
#   eig = lymphoma$x[!training,] %*% t(outmat) )
# myrf<-randomForest( lclass ~ . ,   data=traindf )
# predlymp<-predict(myrf, newdata=testdf)
# print(paste('N-errors:',sum(abs( testdf$lclass != predlymp ) ),
#   'non-zero ',sum(abs( outmat ) > 0 ) ) )
# for ( i in 1:nv )
#   print(paste(' non-zero ',i,' is: ',sum(abs( outmat[i,] ) > 0 ) ) )
# }
# ## End(Not run) # end dontrun

Run the code above in your browser using DataLab