grpreg.gamma {sparseGAM} | 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 may 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.
Usage
grpreg.gamma(y, X, X.test, groups, gamma.shape=1,
penalty=c("gLASSO","gSCAD","gMCP"),
weights, taper, nlambda=100, lambda, max.iter=10000, tol=1e-4)
Arguments
y |
|
X |
|
X.test |
|
groups |
|
gamma.shape |
known shape parameter |
penalty |
group regularization method to use on the groups of coefficients. The options are |
weights |
group-specific, nonnegative weights for the penalty. Default is to use the square roots of the group sizes. |
taper |
tapering term |
nlambda |
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 |
Value
The function returns a list containing the following components:
lambda |
|
beta0 |
|
beta |
|
mu.pred |
|
classifications |
|
loss |
|
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.
Wang, H. and Leng, C. (2007). "Unified LASSO estimation by least squares approximation." Journal of the American Statistical Association, 102:1039-1048.
Examples
## Generate data
set.seed(12345)
X = matrix(runif(100*11), nrow=100)
n = dim(X)[1]
groups = c("a","a","a","b","b","b","c","c","d","e","e")
groups = as.factor(groups)
true.beta = 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), true.beta)
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 LASSO penalty
gamma.mod = grpreg.gamma(y, X, X.test, groups, penalty="gLASSO")
## 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 'mu.pred' corresponds to the kth entry in 'lambda.'
gamma.mod$mu.pred
# Classifications of the 5 groups. The kth column of 'classifications'
# corresponds to the kth entry in 'lambda.'
gamma.mod$classifications