Description Usage Arguments Details Value Author(s) References Examples
Calculate coefficient estimates of Grace based on methods described in Li and Li (2008).
1 |
Y |
outcome vector. |
X |
matrix of predictors. |
L |
penalty weight matrix L. |
lambda.L |
tuning parameter value for the penalty induced by the L matrix (see details). If a sequence of lambda.L values is supplied, K-fold cross-validation is performed. |
lambda.1 |
tuning parameter value for the lasso penalty (see details). If a sequence of lambda.1 values is supplied, K-fold cross-validation is performed. |
lambda.2 |
tuning parameter value for the ridge penalty (see details). If a sequence of lambda.2 values is supplied, K-fold cross-validation is performed. |
normalize.L |
whether the penalty weight matrix L should be normalized. |
K |
number of folds in cross-validation. |
verbose |
whether computation progress should be printed. |
The Grace estimator is defined as
(\hatα, \hatβ) = \arg\min_{α, β}{\|Y-α 1 -Xβ\|_2^2+lambda.L(β^T Lβ)+lambda.1\|β\|_1+lambda.2\|β\|_2^2}
In the formulation, L is the penalty weight matrix. Tuning parameters lambda.L, lambda.1 and lambda.2 may be chosen by cross-validation. In practice, X and Y are standardized and centered, respectively, before estimating \hatβ. The resulting estimate is then rescaled back into the original scale. Note that the intercept \hatα is not penalized.
The Grace estimator could be considered as a generalized elastic net estimator (Zou and Hastie, 2005). It penalizes the regression coefficient towards the space spanned by eigenvectors of L with the smallest eigenvalues. Therefore, if L is informative in the sense that Lβ is small, then the Grace estimator could be less biased than the elastic net.
An R ‘list’ with elements:
intercept |
fitted intercept. |
beta |
fitted regression coefficients. |
Sen Zhao
Zou, H., and Hastie, T. (2005). Regularization and variable selection via the elastic net. Journal of the Royal Statistical Society: Series B, 67, 301-320.
Li, C., and Li, H. (2008). Network-constrained regularization and variable selection for analysis of genomic data. Bioinformatics, 24, 1175-1182.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | set.seed(120)
n <- 100
p <- 200
L <- matrix(0, nrow = p, ncol = p)
for(i in 1:10){
L[((i - 1) * p / 10 + 1), ((i - 1) * p / 10 + 1):(i * (p / 10))] <- -1
}
diag(L) <- 0
ind <- lower.tri(L, diag = FALSE)
L[ind] <- t(L)[ind]
diag(L) <- -rowSums(L)
beta <- c(rep(1, 10), rep(0, p - 10))
Sigma <- solve(L + 0.1 * diag(p))
sigma.error <- sqrt(t(beta) %*% Sigma %*% beta) / 2
X <- mvrnorm(n, mu = rep(0, p), Sigma = Sigma)
Y <- c(X %*% beta + rnorm(n, sd = sigma.error))
grace(Y, X, L, lambda.L = c(0.08, 0.12), lambda.2 = c(0.08, 0.12))
|
Loading required package: MASS
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-16
Loading required package: scalreg
Loading required package: lars
Loaded lars 1.2
[1] "Tuning parameters selected by 10-fold cross-validation:"
[1] "lambda.L = 0.08"
[1] "lambda.1 = 0"
[1] "lambda.2 = 0.08"
$intercept
[1] 0.06363636
$beta
V1 V2 V3 V4 V5 V6
0.897093658 1.110859775 0.528150835 0.956072921 0.846561337 1.224592076
V7 V8 V9 V10 V11 V12
0.284849677 0.752049597 0.880493966 0.497744789 -0.606389931 0.309127017
V13 V14 V15 V16 V17 V18
0.506737506 0.273175141 0.397121005 0.415580768 0.038492630 0.578110623
V19 V20 V21 V22 V23 V24
0.231188881 -0.429917455 -0.050639125 0.287397052 0.018893457 0.263959782
V25 V26 V27 V28 V29 V30
-0.143859825 0.298469439 -0.473352665 -0.166087086 -0.147626266 0.341139211
V31 V32 V33 V34 V35 V36
-0.190912983 -0.437823698 0.009594306 -0.017776682 0.294424444 -0.351018121
V37 V38 V39 V40 V41 V42
0.087086024 -0.097895323 0.196926505 -0.111324405 0.002753995 0.010187534
V43 V44 V45 V46 V47 V48
0.531701328 -0.526129299 0.254896995 0.126225949 -0.356310292 0.264271664
V49 V50 V51 V52 V53 V54
0.229643579 0.034047414 0.274153504 -0.153803233 -0.197620927 -0.125608968
V55 V56 V57 V58 V59 V60
-0.408900525 0.034210343 0.015347232 -0.091170390 0.127721578 -0.111182245
V61 V62 V63 V64 V65 V66
0.011397926 0.289035494 0.570768349 0.299017361 -0.022660018 0.096961883
V67 V68 V69 V70 V71 V72
-0.258803095 0.034899971 -0.227304860 0.075029641 -0.456625582 0.235970659
V73 V74 V75 V76 V77 V78
-0.074546533 -0.089804414 0.108606943 -0.040903623 -0.648517471 0.140134034
V79 V80 V81 V82 V83 V84
-0.146956073 0.160931578 -0.116212249 -0.078093505 -0.257062440 -0.061006302
V85 V86 V87 V88 V89 V90
-0.120594400 -0.177902699 -0.057977320 -0.355131369 0.251819456 0.359521192
V91 V92 V93 V94 V95 V96
0.361678687 -0.145913664 0.004573460 -0.419828660 0.106580059 0.361003765
V97 V98 V99 V100 V101 V102
-0.229630451 0.153517519 -0.303542388 0.401108414 -0.012951503 -0.500035076
V103 V104 V105 V106 V107 V108
0.075447621 -0.009818410 -0.339796511 -0.363134314 0.397459577 0.193180875
V109 V110 V111 V112 V113 V114
0.150442275 0.172690117 -0.387720536 0.379344930 0.077987318 0.294236712
V115 V116 V117 V118 V119 V120
0.211472232 0.006006054 -0.233117829 0.106633875 -0.345518337 0.019588444
V121 V122 V123 V124 V125 V126
0.137092185 -0.223107287 0.439234339 -0.032330761 -0.237931503 0.439851613
V127 V128 V129 V130 V131 V132
-0.125948493 -0.347114704 0.454159822 0.333437686 -0.167641940 -0.109621843
V133 V134 V135 V136 V137 V138
0.126730952 0.686902496 -0.228510917 -0.015443680 -0.002217531 0.152891757
V139 V140 V141 V142 V143 V144
0.139898628 0.364585620 -0.008277077 -0.391500336 -0.217535889 -0.087851251
V145 V146 V147 V148 V149 V150
0.142887381 -0.112262205 -0.365862163 0.007089425 0.432136308 -0.108017365
V151 V152 V153 V154 V155 V156
-0.212477657 0.354712992 0.047180173 -0.399594668 0.502462138 0.082688581
V157 V158 V159 V160 V161 V162
0.619683272 -0.252160014 -0.048067746 -0.170261311 -0.176632167 0.618985944
V163 V164 V165 V166 V167 V168
-0.359971312 -0.271830645 0.304286955 0.161651822 -0.535750020 -0.750637020
V169 V170 V171 V172 V173 V174
0.002466773 -0.376734708 0.523386867 -0.015328769 -0.038553043 -0.050634607
V175 V176 V177 V178 V179 V180
-0.421251934 -0.111533916 0.262179804 0.146079880 0.048786741 -0.445490819
V181 V182 V183 V184 V185 V186
0.052449180 -0.008249418 0.153434301 0.334984250 0.212045202 -0.235538074
V187 V188 V189 V190 V191 V192
-0.026733512 0.446843538 -0.171887132 -0.112668719 -0.112059876 0.366205266
V193 V194 V195 V196 V197 V198
0.059578181 -0.110072286 -0.424827433 -0.017801800 0.340387218 -0.364406470
V199 V200
0.047563158 0.274981762
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.