Last data update: 2014.03.03
|
R: CV for ISS
CV for ISS
Description
Cross-validation method to tuning the parameter t for ISS.
Usage
cv.iss(X, y, K = 5, t, intercept = TRUE, normalize = TRUE,
plot.it = TRUE, se = TRUE, ...)
Arguments
X |
An n-by-p matrix of predictors
|
y |
Response Variable
|
K |
Folds number for CV. Default is 5.
|
t |
A vector of predecided tuning parameter.
|
intercept |
If TRUE, an intercept is included in the model (and not
penalized), otherwise no intercept is included. Default is TRUE.
|
normalize |
if TRUE, each variable is scaled to have L2 norm
square-root n. Default is TRUE.
|
plot.it |
Plot it? Default is TRUE
|
se |
Include standard error bands? Default is TRUE
|
... |
Additonal arguments passing to lb
|
Details
K-fold cross-validation method is used to tuning the parameter $t$ for ISS.
Mean square error is used as prediction error.
Value
A list is returned. The list contains a vector of parameter t,
crossvalidation error cv.error, and the estimated standard deviation for it cv.sd
Author(s)
Feng Ruan, Jiechao Xiong and Yuan Yao
References
Ohser, Ruan, Xiong, Yao and Yin, Sparse Recovery via Differential
Inclusions, http://arxiv.org/abs/1406.7728
Examples
#Examples in the reference paper
library(MASS)
n = 200;p = 100;k = 30;sigma = 1
Sigma = 1/(3*p)*matrix(rep(1,p^2),p,p)
diag(Sigma) = 1
A = mvrnorm(n, rep(0, p), Sigma)
u_ref = rep(0,p)
supp_ref = 1:k
u_ref[supp_ref] = rnorm(k)
u_ref[supp_ref] = u_ref[supp_ref]+sign(u_ref[supp_ref])
b = as.vector(A%*%u_ref + sigma*rnorm(n))
cv.iss(A,b,intercept = FALSE,normalize = FALSE)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Libra)
Loading required package: nnls
Loaded Libra 1.5
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Libra/cv.iss.Rd_%03d_medium.png", width=480, height=480)
> ### Name: cv.iss
> ### Title: CV for ISS
> ### Aliases: cv.iss
> ### Keywords: Cross-validation
>
> ### ** Examples
>
> #Examples in the reference paper
> library(MASS)
> n = 200;p = 100;k = 30;sigma = 1
> Sigma = 1/(3*p)*matrix(rep(1,p^2),p,p)
> diag(Sigma) = 1
> A = mvrnorm(n, rep(0, p), Sigma)
> u_ref = rep(0,p)
> supp_ref = 1:k
> u_ref[supp_ref] = rnorm(k)
> u_ref[supp_ref] = u_ref[supp_ref]+sign(u_ref[supp_ref])
> b = as.vector(A%*%u_ref + sigma*rnorm(n))
> cv.iss(A,b,intercept = FALSE,normalize = FALSE)
$t
[1] 0.2408336 0.4816672 0.7225008 0.9633344 1.2041680 1.4450016
[7] 1.6858352 1.9266688 2.1675024 2.4083359 2.6491695 2.8900031
[13] 3.1308367 3.3716703 3.6125039 3.8533375 4.0941711 4.3350047
[19] 4.5758383 4.8166719 5.0575055 5.2983391 5.5391727 5.7800063
[25] 6.0208399 6.2616735 6.5025071 6.7433407 6.9841742 7.2250078
[31] 7.4658414 7.7066750 7.9475086 8.1883422 8.4291758 8.6700094
[37] 8.9108430 9.1516766 9.3925102 9.6333438 9.8741774 10.1150110
[43] 10.3558446 10.5966782 10.8375118 11.0783454 11.3191790 11.5600125
[49] 11.8008461 12.0416797 12.2825133 12.5233469 12.7641805 13.0050141
[55] 13.2458477 13.4866813 13.7275149 13.9683485 14.2091821 14.4500157
[61] 14.6908493 14.9316829 15.1725165 15.4133501 15.6541837 15.8950173
[67] 16.1358509 16.3766844 16.6175180 16.8583516 17.0991852 17.3400188
[73] 17.5808524 17.8216860 18.0625196 18.3033532 18.5441868 18.7850204
[79] 19.0258540 19.2666876 19.5075212 19.7483548 19.9891884 20.2300220
[85] 20.4708556 20.7116892 20.9525227 21.1933563 21.4341899 21.6750235
[91] 21.9158571 22.1566907 22.3975243 22.6383579 22.8791915 23.1200251
[97] 23.3608587 23.6016923 23.8425259 24.0833595
$cv.error
[1] 104.0235703 55.9218943 29.3743896 17.5241426 7.7336442 4.0901808
[7] 1.6820064 1.3788085 1.3788085 0.9702385 0.9863123 0.9831575
[13] 0.9936604 0.9972698 0.9968382 0.9945700 0.9945700 1.0035687
[19] 1.0222776 1.0557136 1.0986307 1.0986307 1.0986307 1.0986307
[25] 1.1107739 1.1148135 1.1152268 1.1184672 1.1249038 1.1663781
[31] 1.1796934 1.2001178 1.2402881 1.2760852 1.2923497 1.2890214
[37] 1.3128881 1.3107256 1.3280799 1.3113611 1.3230735 1.3246951
[43] 1.3113838 1.3248595 1.3321300 1.3189822 1.3189822 1.3129338
[49] 1.3194925 1.3194925 1.3290249 1.3346786 1.3946038 1.4433222
[55] 1.4380507 1.4324227 1.4324227 1.4418535 1.4418535 1.4477763
[61] 1.4577251 1.4735146 1.4735146 1.4724593 1.4848703 1.4848703
[67] 1.4848703 1.4933316 1.5206724 1.5206724 1.5206724 1.5309948
[73] 1.5366303 1.5366303 1.5297148 1.5332426 1.5369877 1.5370167
[79] 1.5287736 1.5404406 1.5357226 1.5336787 1.5152315 1.5413301
[85] 1.5629770 1.5617242 1.5507524 1.5507524 1.5419444 1.5378732
[91] 1.5372519 1.5385747 1.5385747 1.5385747 1.5502187 1.5502187
[97] 1.5654868 1.5654868 1.5964659 1.5964659
$cv.sd
[1] 9.93179453 4.23129989 4.81219672 3.32830134 2.44275365 1.71670939
[7] 0.48195901 0.46387845 0.46387845 0.07055978 0.07522642 0.07606238
[13] 0.08475163 0.08580463 0.08593561 0.08609850 0.08609850 0.08385227
[19] 0.07452824 0.08789558 0.08075612 0.08075612 0.08075612 0.08075612
[25] 0.08797217 0.08182836 0.08204793 0.08015802 0.08430566 0.08917934
[31] 0.08487484 0.09673346 0.08788004 0.07201019 0.06968222 0.07622553
[37] 0.07091930 0.07268055 0.07901727 0.07988066 0.07815650 0.07686286
[43] 0.07659359 0.09221249 0.09215465 0.10318238 0.10318238 0.09834246
[49] 0.10676986 0.10676986 0.10976581 0.10804679 0.12387126 0.10720152
[55] 0.11005903 0.11159241 0.11159241 0.11307499 0.11307499 0.11439441
[61] 0.11211266 0.11059770 0.11059770 0.11127231 0.11111927 0.11111927
[67] 0.11111927 0.10600989 0.10826620 0.10826620 0.10826620 0.12012443
[73] 0.11907466 0.11907466 0.11918264 0.12003463 0.11784845 0.11783183
[79] 0.11898439 0.11298566 0.11466892 0.11545034 0.12446159 0.13519112
[85] 0.13890517 0.13960251 0.14403597 0.14403597 0.13645479 0.13862966
[91] 0.13866277 0.13821976 0.13821976 0.13821976 0.14473028 0.14473028
[97] 0.13690244 0.13690244 0.12530710 0.12530710
>
>
>
>
>
>
> dev.off()
null device
1
>
|
|