cv.spfac | R Documentation |
Evalute the CV values on a set of grids of penalty parameters.
cv.spfac(X, lambda1_set, lambda2_set, nfolds=5)
X |
a |
lambda1_set |
a positve vector, the grid for lambda_1. |
lambda2_set |
a positve vector, the grid for lambda_2. |
nfolds |
a positve integer, the folds of cross validation. |
return a list including following components:
lamcv.min |
a 3-dimensional vector, the penalty value for lambda_1 and lambda_2 corresponding to the minimum CV on grids. |
lamcvMat |
a numeric matrix with three columns named lambda_1, lambda_2 and cv, where each row is corresponding to each grid. |
lambda1_set |
the used grid for lambda_1. |
lambda2_set |
the used grid for lambda_2. |
nothing
Liu Wei
Wei Liu, Huazhen Lin, (2019). Estimation and inference on high-dimensional sparse factor models.
gsspFactorm
.
datlist1 <- gendata_Fac(n= 100, p = 300, rho=1) X <- datlist1$X spfac <- gsspFactorm(X, q=NULL) # use default values for lambda's. assessBsFun(spfac$sphB, datlist1$B0) lambda1_set <- seq(0.2, 2, by=0.3) lambda2_set <- 1:8 # select lambda's values using CV method. lamList <- cv.spfac(X, lambda1_set, lambda2_set, nfolds=5) spfac <- gsspFactorm(X, q=NULL,lamList$lamcv.min[1], lamList$lamcv.min[2]) assessBsFun(spfac$sphB, datlist1$B0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.