Description Usage Arguments Value Author(s) Examples
View source: R/networkEiganat.R
Decomposes a matrix into sparse eigenevectors to maximize explained variance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | networkEiganat(
Xin,
sparseness = c(0.1, 0.1),
nvecs = 5,
its = 5,
gradparam = 1,
mask = NA,
v,
prior,
pgradparam = 0.1,
clustval = 0,
downsample = 0,
doscale = T,
domin = T,
verbose = F,
dowhite = 0,
timeme = T,
addb = T,
useregression = T
)
|
Xin |
n by p input images , subjects or time points by row , spatial variable lies along columns |
sparseness |
sparseness pair c( 0.1 , 0.1 ) |
nvecs |
number of vectors |
its |
number of iterations |
gradparam |
gradient descent parameter for data |
mask |
optional antsImage mask |
v |
the spatial solultion |
prior |
the prior |
pgradparam |
gradient descent parameter for prior term |
clustval |
integer greater than or equal to zero |
downsample |
bool |
doscale |
bool |
domin |
bool |
verbose |
bool |
dowhite |
bool |
timeme |
bool |
addb |
bool |
useregression |
bool |
outputs a decomposition of a population or time series matrix
Avants BB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | ## Not run:
mat<-replicate(100, rnorm(20))
mydecom<-networkEiganat( mat, nvecs=5 )
ch1<-usePkg('randomForest')
ch2<-usePkg('BGLR')
if ( ch1 & ch2 ) {
data(mice)
snps<-quantifySNPs( mice.X )
numericalpheno<-as.matrix( mice.pheno[,c(4,5,13,15) ] )
numericalpheno<-residuals( lm( numericalpheno ~
as.factor(mice.pheno$Litter) ) )
phind<-3
nfolds<-6
train<-sample( rep( c(1:nfolds), 1800/nfolds ) )
train<-( train < 4 )
lowr<-lowrankRowMatrix(as.matrix( snps[train,] ),900)
snpdS<-sparseDecom( lowr , nvecs=2 , sparseness=( -0.001), its=3 )
snpdF<-sparseDecom( lowrankRowMatrix(as.matrix( snps[train,] ),100),
nvecs=2 , sparseness=( -0.001), its=3 )
projmat<-as.matrix( snpdS$eig )
projmat<-as.matrix( snpdF$eig )
snpdFast<-networkEiganat( as.matrix( snps[train,] ), nvecs=2 ,
sparseness=c( 1, -0.001 ) , downsample=45, verbose=T, its=3,
gradparam=10 )
snpdSlow<-networkEiganat( as.matrix( snps[train,] ), nvecs=2 ,
sparseness=c( 1, -0.001 ) , downsample=0, verbose=T,
its=3, gradparam=10 )
snpd<-snpdSlow
snpd<-snpdFast
projmat<-as.matrix( snpd$v )
snpdF<-sparseDecom( lowrankRowMatrix(as.matrix( snps[train,] ),10) ,
nvecs=2 , sparseness=( -0.001), its=3 )
projmat<-as.matrix( snpdS$eig )
snpse<-as.matrix( snps[train, ] ) %*% projmat
traindf<-data.frame( bmi=numericalpheno[train,phind] , snpse=snpse)
snpse<-as.matrix( snps[!train, ] ) %*% projmat
testdf <-data.frame( bmi=numericalpheno[!train,phind] , snpse=snpse )
myrf<-glm( bmi ~ . , data=traindf )
preddf<-predict(myrf, newdata=testdf )
cor.test(preddf, testdf$bmi )
if ( usePkg('visreg') ) {
mydf<-data.frame( PredictedBMIfromSNPs=preddf, RealBMI=testdf$bmi )
mymdl<-lm( PredictedBMIfromSNPs ~ RealBMI, data=mydf)
visreg::visreg(mymdl) }
###########
# vs glmnet #
###########
haveglm<-usePkg('glmnet')
if ( haveglm ) {
kk<-glmnet(y=numericalpheno[train,phind],x=snps[train,] )
ff<-predict(kk,newx=snps[!train,])
cor.test(ff[,25],numericalpheno[!train,phind])
mydf<-data.frame( PredictedBMIfromSNPs=ff[,25], RealBMI=testdf$bmi )
mymdl<-lm( PredictedBMIfromSNPs ~ RealBMI, data=mydf)
} # glmnet check
} # ch1 and ch2
###########
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.