Description Usage Arguments Value Examples
This function takes in an outcome and covariates, and estimates the posterior mode of the spike and slab group lasso penalty beginning at a small value of lambda0 and continuing on a path until the chosen lambda0
1 2 3 |
Y |
The outcome to be analyzed |
X |
An n by p matrix of covariates |
lambda1 |
Prior parameter for the slab component of the prior |
lambda0 |
Prior parameter for the spike component of the prior |
lambda0seq |
Sequence of lambda0 grids to iterate through |
groups |
A vector of length p denoting which group each covariate is in |
a |
First hyperparameter for the beta prior denoting the prior probability of being in the slab |
b |
Second hyperparameter for the beta prior denoting the prior probability of being in the slab |
M |
Positive number less than p indicating how often to update theta and sigma. There is no need to change this unless trying to optimize computation time |
forceGroups |
A vector containing the indices of any groups you wish to automatically include in the model and not penalize |
A list of values containing the regression coefficients, the intercept, the estimate of the residual variance (this is simply the marginal variance of Y if UpdateSigma=FALSE), An estimate of theta the prior probability of entering into the slab, and the number of iterations it took to converge
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Here we generate 200 samples from 100 covariates
n = 200
G = 100
x = mvtnorm::rmvnorm(n, sigma=diag(G))
X = matrix(NA, nrow=n, ncol=G*2)
for (g in 1 : G) {
X[,2*(g-1) + 1] = x[,g]
X[,2*g] = x[,g]^2
}
Y = 200 + x[,1] + x[,2] + 0.6*x[,2]^2 + rnorm(n, sd=1)
## Now fit model for chosen lambda0 and lambda1 values
modSSGL = SSGLpath(Y=Y, X=X, lambda1=.1, lambda0=10,
groups = rep(1:G, each=2))
modSSGL
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.