Fit SCAD SVM model
scadsvc.Rd
SVM with variable selection (clone selection) using SCAD penalty.
Usage
scadsvc(lambda1 = 0.01, x, y, a = 3.7, tol= 10^(-4), class.weights= NULL,
seed=123, maxIter=700, verbose=TRUE)
Arguments
- lambda1
tuning parameter in SCAD function (default : 0.01)
- x
n-by-d data matrix to train (n chips/patients, d clones/genes)
- y
vector of class labels -1 or 1\'s (for n chips/patiens )
- a
tuning parameter in scad function (default: 3.7)
- tol
the cut-off value to be taken as 0
- class.weights
a named vector of weights for the different classes, used for asymetric class sizes. Not all factor levels have to be supplied (default weight: 1). All components have to be named. (default: NULL)
- seed
seed
- maxIter
maximal iteration, default: 700
- verbose
verbose, default: TRUE
Value
- w
coefficients of the hyperplane.
- b
intercept of the hyperplane.
- xind
the index of the selected features (genes) in the data matrix.
- xqx
internal calculations product \(xqx = 0.5 * x1 * inv_Q * t(x1)\), see code for more details.
- fitted
fit of hyperplane f(x) for all _training_ samples with reduced set of features.
- index
the index of the resulting support vectors in the data matrix.
- type
type of svm, from svm function.
- lambda1
optimal lambda1.
- gacv
corresponding gacv.
- iter
nuber of iterations.
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.
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
model <- scadsvc(as.matrix(t(train$x)), y=train$y, lambda=0.01)
#> [1] "start iterations:"
#> [1] "scad converged in 9 iterations"
print(str(model))
#> 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
print(model)
#>
#> Bias = -0.03401226
#> Selected Variables= pos1 pos2 pos3 pos4 pos5 neg1 neg2 neg3 neg4 neg5 bal1 bal2 bal3 bal5 bal6 bal7 bal9 bal10 bal11 bal12 bal13 bal16 bal17 bal18 bal19 bal20 bal21 bal22 bal23 bal24 bal25 bal26 bal27 bal28 bal29 bal30 bal31 bal32 bal33 bal34 bal35 bal36 bal37 bal38 bal39 bal40 bal41 bal42 bal43 bal44 bal46 bal47 bal48 bal49 bal50 bal51 bal52 bal53 bal54 bal55 bal56 bal57 bal58 bal59 bal60 bal61 bal62 bal63 bal64 bal65 bal66 bal67 bal68 bal69 bal70 bal71 bal72 bal73 bal74 bal75 bal76 bal77 bal78 bal79 bal80 bal81 bal83 bal84 bal86 bal87 bal88 bal90
#> Coefficients:
#> pos1 pos2 pos3 pos4 pos5 neg1
#> 0.90955973 1.22480258 0.88002752 0.51730723 1.14042067 -0.89468804
#> neg2 neg3 neg4 neg5 bal1 bal2
#> -0.43818371 -0.21293659 -1.20568431 -1.21418360 -0.10118113 -0.70967352
#> bal3 bal5 bal6 bal7 bal9 bal10
#> 0.33599993 0.10692685 0.28609573 -0.17763121 -0.15925854 -0.10510649
#> bal11 bal12 bal13 bal16 bal17 bal18
#> 0.15029201 -0.44111494 0.20725643 -0.14456508 0.26237408 -0.15746206
#> bal19 bal20 bal21 bal22 bal23 bal24
#> -0.15935625 -0.84453378 0.16942347 0.21879871 0.59584989 0.19418889
#> bal25 bal26 bal27 bal28 bal29 bal30
#> -0.13213214 0.22527711 -0.58930416 0.09744356 0.31787684 0.45157157
#> bal31 bal32 bal33 bal34 bal35 bal36
#> 0.15652711 0.06947663 -0.23303939 -0.54624676 -0.46293890 0.26960990
#> bal37 bal38 bal39 bal40 bal41 bal42
#> -0.21485272 0.07748583 -0.16545216 -0.11277902 0.24936357 -0.37451411
#> bal43 bal44 bal46 bal47 bal48 bal49
#> 0.23639990 -0.39446194 0.05374167 0.44266113 -0.05646721 0.36357278
#> bal50 bal51 bal52 bal53 bal54 bal55
#> 0.39470649 0.21314700 -0.38577263 -0.49098664 -0.13996122 -0.32732887
#> bal56 bal57 bal58 bal59 bal60 bal61
#> -0.57940948 0.27219758 0.04980174 -0.05760230 0.53541416 0.70985471
#> bal62 bal63 bal64 bal65 bal66 bal67
#> 0.11326483 0.41113190 -0.13657480 -0.46424269 0.07664674 0.51321755
#> bal68 bal69 bal70 bal71 bal72 bal73
#> 0.08138307 0.21317335 0.04040227 -0.35703858 -0.60339800 0.09918741
#> bal74 bal75 bal76 bal77 bal78 bal79
#> 0.29333203 -0.06383283 0.05024979 -0.23317950 -0.54833937 -0.32259635
#> bal80 bal81 bal83 bal84 bal86 bal87
#> 0.67043232 -0.11032972 0.18739860 0.28849419 -0.32534129 0.45262742
#> bal88 bal90
#> 0.26339260 -0.28394962
#>