Description Usage Arguments Details Value References Examples
K-fold crossvalidation for the choice of the lambda1.
1 | cv.lambda1(A,B, nfold,seq_lambda1,niter=1000,tol=1e-6,scaling=FALSE)
|
A |
An observed dataset from the first condition. |
B |
An observed dataset from the second condition. |
nfold |
the number of folds in the crossvalidation(i.e., K in K-fold cross validation) |
seq_lambda1 |
A sequence of tuning parameters for the ridge penalty |
niter |
A total number of iterations in the block-wise coordinate descent. |
tol |
A tolerance for the convergence. |
scaling |
a logical flag for scaling variable to have unit variance. Default is FALSE. |
cv.lambda1 returns a vector of the K-fold crossvalidated errors and matrices of the initial estimates of the precision matrices.
cv |
A vector of crossvalidated errors corresponding to a given sequence of tuning paramters. |
pm1 |
A matrix of the inverse of the linear shrinkage covariance estimates for the first condition. |
pm2 |
A matrix of the inverse of the linear shrinkage covariance estimates for the second condition. |
Yu, D., Lee, S. H., Lim, J., Xiao, G., Craddock, R. C., and Biswal, B. B. (2018). Fused Lasso Regression for Identifying Differential Correlations in Brain Connectome Graphs. Statistical Analysis and Data Mining, 11, 203–226.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(MASS)
## True precision matrix
omega1 <- matrix(0,5,5)
omega1[1,2] <- omega1[1,3] <- omega1[1,4] <- 1
omega1[2,3] <- omega1[3,4] <- 1.5
omega1 <- t(omega1) + omega1
diag(omega1) <- 3
omega2 <- matrix(0,5,5)
omega2[1,3] <- omega2[1,5] <- 1.5
omega2[2,3] <- omega2[2,4] <- 1.5
omega2 <- t(omega2) + omega2
diag(omega2) <- 3
Sig1 = solve(omega1)
Sig2 = solve(omega2)
X1 = mvrnorm(50,rep(0,5),Sig1)
X2 = mvrnorm(50,rep(0,5),Sig2)
nfold = 5
seq_lam1 = seq(0.5,3,by=0.5)
cv_vec = cv.lambda1(X1,X2,nfold,seq_lam1,niter=1000,tol=1e-6)$cv
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.