Calculate Generalized Approximate Cross Validation Error Estimation for SCAD SVM model
findgacv.scad.Rd
calculate generalized approximate cross validation error (GACV) estimation for SCAD SVM model
References
Zhang, H. H., Ahn, J., Lin, X. and Park, C. (2006). Gene selection using support vector machines with nonconvex penalty. Bioinformatics, 22, pp. 88-95.
Wahba G., Lin, Y. and Zhang, H. (2000). GACV for support vector machines, or, another way to look at margin-like quantities, in A. J. Smola, P. Bartlett, B. Schoelkopf and D. Schurmans (eds), Advances in Large Margin Classifiers, MIT Press, pp. 297-309.
Author
Natalia Becker
natalie_becker@gmx.de
Examples
# simulate data
train<-sim.data(n = 200, ng = 100, nsg = 10, corr=FALSE, seed=12)
print(str(train))
#> List of 3
#> $ x : num [1:100, 1:200] 1.2048 -0.1389 0.864 0.0725 1.4274 ...
#> ..- attr(*, "dimnames")=List of 2
#> .. ..$ : chr [1:100] "pos1" "pos2" "pos3" "pos4" ...
#> .. ..$ : chr [1:200] "1" "2" "3" "4" ...
#> $ y : Named num [1:200] 1 1 -1 1 -1 1 1 1 1 -1 ...
#> ..- attr(*, "names")= chr [1:200] "1" "2" "3" "4" ...
#> $ seed: num 12
#> NULL
# train data
ff <- scadsvc(as.matrix(t(train$x)), y=train$y, lambda=0.01)
#> [1] "start iterations:"
#> [1] "scad converged in 9 iterations"
print(str(ff))
#> List of 9
#> $ w : Named num [1:92] 0.91 1.225 0.88 0.517 1.14 ...
#> ..- attr(*, "names")= chr [1:92] "pos1" "pos2" "pos3" "pos4" ...
#> $ b : num -0.034
#> $ xind : int [1:92] 1 2 3 4 5 6 7 8 9 10 ...
#> $ index : int [1:85] 6 19 20 25 40 48 49 54 56 57 ...
#> $ xqx : num [1:200, 1:200] 110.635 20.309 -14.916 37.297 0.445 ...
#> ..- attr(*, "dimnames")=List of 2
#> .. ..$ : chr [1:200] "1" "2" "3" "4" ...
#> .. ..$ : chr [1:200] "1" "2" "3" "4" ...
#> $ fitted : num [1:200] 11.29 4.29 -3.86 8.48 -1.53 ...
#> $ type : num 0
#> $ lambda1: num 0.01
#> $ iter : num 9
#> - attr(*, "class")= chr [1:2] "scadsvm" "penSVM"
#> NULL
# estimate gacv error
(gacv<- findgacv.scad(train$y, model=ff))
#> [1] 0