gamma_grpreg {SSGL} | R Documentation |
Group-regularized Gamma Regression
Description
This function implements group-regularized gamma regression with a known shape parameter \nu
and the log link. In gamma regression, we assume that y_i \sim Gamma(\mu_i, \nu)
, where
f(y_i | \mu_i, \nu ) = \frac{1}{\Gamma(\nu)} (\frac{\nu}{\mu_i})^{\nu} \exp(-\frac{\nu}{\mu_i}y_i) y_i^{\nu-1}, y > 0.
Then E(y_i) = \mu_i
, and we relate \mu_i
to a set of p
covariates x_i
through the log link,
\log(\mu_i) = \beta_0 + x_i^T \beta, i=1,..., n
If the covariates in each x_i
are grouped according to known groups g=1, ..., G
, then this function can estimate some of the G
groups of coefficients as all zero, depending on the amount of regularization. Our implementation for regularized gamma regression is based on the least squares approximation approach of Wang and Leng (2007), and hence, the function does not allow the total number of covariates p
to be greater than sample size.
In addition, this function has the option of returning the generalized information criterion (GIC) of Fan and Tang (2013) for each regularization parameter in the grid lambda
. The GIC can be used for model selection and serves as a useful alternative to cross-validation.
Usage
gamma_grpreg(Y, X, groups, X_test, gamma_shape=1,
penalty=c("gLASSO","gSCAD","gMCP"),
group_weights, taper, n_lambda=100, lambda,
max_iter=10000, tol=1e-4, return_GIC=TRUE)
Arguments
Y |
|
X |
|
groups |
|
X_test |
|
gamma_shape |
known shape parameter |
penalty |
group regularization method to use on the groups of regression coefficients. The options are |
group_weights |
group-specific, nonnegative weights for the penalty. Default is to use the square roots of the group sizes. |
taper |
tapering term |
n_lambda |
number of regularization parameters |
lambda |
grid of |
max_iter |
maximum number of iterations in the algorithm. Default is |
tol |
convergence threshold for algorithm. Default is |
return_GIC |
Boolean variable for whether or not to return the GIC. Default is |
Value
The function returns a list containing the following components:
lambda |
|
beta |
|
beta0 |
|
classifications |
|
Y_pred |
|
GIC |
|
lambda_min |
The value in |
min_index |
The index of |
References
Breheny, P. and Huang, J. (2015). "Group descent algorithms for nonconvex penalized linear and logistic regression models with grouped predictors." Statistics and Computing, 25:173-187.
Fan, Y. and Tang, C. Y. (2013). "Tuning parameter selection in high dimensional penalized likelihood." Journal of the Royal Statistical Society: Series B (Statistical Methodology), 75:531-552.
Wang, H. and Leng, C. (2007). "Unified LASSO estimation by least squares approximation." Journal of the American Statistical Association, 102:1039-1048.
Yuan, M. and Lin, Y. (2006). "Model selection and estimation in regression with grouped variables." Journal of the Royal Statistical Society: Series B (Statistical Methodology), 68:49-67.
Examples
## Generate data
set.seed(1234)
X = matrix(runif(100*11), nrow=100)
n = dim(X)[1]
groups = c(1,1,1,2,2,2,3,3,4,5,5)
beta_true = c(-1,1,1,0,0,0,0,0,0,1.5,-1.5)
## Generate responses from gamma regression with known shape parameter 1
eta = crossprod(t(X), beta_true)
shape = 1
Y = rgamma(n, rate=shape/exp(eta), shape=shape)
## Generate test data
n_test = 50
X_test = matrix(runif(n_test*11), nrow=n_test)
## Fit gamma regression models with the group SCAD penalty
gamma_mod = gamma_grpreg(Y, X, groups, X_test, penalty="gSCAD")
## Tuning parameters used to fit models
gamma_mod$lambda
## Predicted n_test-dimensional vectors mu=E(Y_test) based on test data, X_test.
## The kth column of 'Y_pred' corresponds to the kth entry in 'lambda.'
gamma_mod$Y_pred
## Classifications of the 5 groups. The kth column of 'classifications'
# corresponds to the kth entry in 'lambda.'
gamma_mod$classifications
## Plot lambda vs. GIC
plot(gamma_mod$lambda, gamma_mod$GIC, type='l')
## Model selection with the lambda that minimizes GIC
gamma_mod$lambda_min
gamma_mod$min_index
gamma_mod$classifications[, gamma_mod$min_index]
gamma_mod$beta[, gamma_mod$min_index]