Description Usage Arguments Value References Examples
This is a stand-alone function for group-regularized regression models in the exponential dispersion family with the spike-and-slab group lasso (SSGL) penalty. Let y_i denote the ith response and x_i denote a p-dimensional vector of covariates. We fit models of the form,
g(E(y_i)) = β_0 + x_i^T β, i = 1, ..., n,
where g is a monotone increasing link function. The identity link function is used for Gaussian regression, the logit link is used for binomial regression, and the log link is used for Poisson, negative binomial, and gamma regression.
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.
Another implementation of the SSGL model for Gaussian regression models is available on Github at https://github.com/jantonelli111/SSGL. This package sparseGAM
also implements the SSGL model for binomial, Poisson, negative binomial, and gamma regression.
1 2 3 4 |
y |
n \times 1 vector of responses for training data. |
X |
n \times p design matrix for training data, where the jth column of |
X.test |
n_{test} \times p design matrix for test data to calculate predictions. |
groups |
p-dimensional vector of group labels. The jth entry in |
family |
exponential dispersion family. Allows for |
nb.size |
known size parameter α in NB(α,μ_i) distribution for the negative binomial responses. Default is |
gamma.shape |
known shape parameter ν in Gamma(μ_i,ν) distribution for gamma responses. Default is |
weights |
group-specific, nonnegative weights for the penalty. Default is to use the square roots of the group sizes. |
nlambda0 |
number of spike hyperparameters L. Default is |
lambda0 |
grid of L spike hyperparameters λ_0. The user may specify either a scalar or a vector. If the user does not provide this, the program chooses the grid automatically. |
lambda1 |
slab hyperparameter λ_1 in the SSGL prior. Default is |
a |
shape hyperparameter for the Beta(a,b) prior on the mixing proportion in the SSGL prior. Default is |
b |
shape hyperparameter for the Beta(a,b) prior on the mixing proportion in the SSGL prior. Default is |
max.iter |
maximum number of iterations in the algorithm. Default is |
tol |
convergence threshold for algorithm. Default is |
print.iter |
Boolean variable for whether or not to print the current |
The function returns a list containing the following components:
lambda0 |
L \times 1 vector of spike hyperpameters |
beta0 |
L \times 1 vector of estimated intercepts. The kth entry in |
beta |
p \times L matrix of estimated regression coefficients. The kth column in |
mu.pred |
n_{test} \times L matrix of predicted mean response values μ_{test} = E(Y_{test}) based on the test data in |
classifications |
G \times L matrix of classifications, where G is the number of groups. An entry of "1" indicates that the group was classified as nonzero, and an entry of "0" indicates that the group was classified as zero. The kth column of |
loss |
vector of either the residual sum of squares ( |
Bai R. (2021). "Spike-and-slab group lasso for consistent Bayesian estimation and variable selection in non-Gaussian generalized additive models." arXiv pre-print arXiv:2007.07021.
Bai, R., Moran, G. E., Antonelli, J. L., Chen, Y., and Boland, M.R. (2021). "Spike-and-slab group lassos for grouped regression and sparse generalized additive models." Journal of the American Statistical Association, in press.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ## Generate data
set.seed(12345)
X = matrix(runif(100*10), nrow=100)
n = dim(X)[1]
groups = c("A","A","A","B","B","B","C","C","D","D")
groups = as.factor(groups)
true.beta = c(-2.5,1.5,1.5,0,0,0,2,-2,0,0)
## Generate responses from Gaussian distribution
y = crossprod(t(X),true.beta) + rnorm(n)
## Generate test data
n.test = 50
X.test = matrix(runif(n.test*10), nrow=n.test)
## Fit SSGL model with 10 spike hyperparameters
## Note that if user does not specify lambda0, the SSGL function chooses a grid automatically.
SSGL.mod = SSGL(y, X, X.test, groups, family="gaussian", lambda0=seq(from=50,to=5,by=-5))
## Regression coefficient estimates
SSGL.mod$beta
# 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.'
SSGL.mod$mu.pred
# Classifications of the 8 groups. The kth column of 'classifications'
# corresponds to the kth entry in 'lambda.'
SSGL.mod$classifications
## Example with binomial regression
## Generate binary responses
eta = crossprod(t(X), true.beta)
y = rbinom(n, size=1, prob=1/(1+exp(-eta)))
## Fit SSGL model with 10 spike hyperparameters
## Note that if user does not specify lambda0, the SSGL function chooses a grid automatically.
SSGL.mod = SSGL(y, X, X.test, groups, family="binomial",
lambda0=seq(from=10,to=1,by=-1))
## Predicted probabilities of success mu=E(Y.test) based on test data, X.test
SSGL.mod$mu.pred
## Classifications of the 8 groups.
SSGL.mod$classifications
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.