Description Usage Arguments Value Examples
View source: R/BayesGroupBridgeSMU.R
Bayesian Group Bridge regression
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | BayesGroupBridgeSMU(
x,
y,
alpha = 0.5,
group = group,
max.steps = 20000,
n.burn = 10000,
n.thin = 1,
r = 1,
delta = 0.1,
posterior.summary.beta = "mean",
posterior.summary.lambda = "mean",
posterior.summary.alpha = "mean",
beta.ci.level = 0.95,
lambda.ci.level = 0.95,
alpha.ci.level = 0.95,
seed = 1234,
alpha.prior = "none",
a = 10,
b = 10,
update.sigma2 = T
)
|
x |
A numeric matrix with standardized predictors in columns and samples in rows. |
y |
A mean-centered continuous response variable with matched sample rows with x. |
alpha |
Concavity parameter of the group bridge penalty (the exponent to which the L1 norm of the coefficients are raised). Default is 0.5, the square root. Must be between 0 and 1 (0 exclusive). It can also be estimated from the data by specifying arbitrary non-postive value such as 0. |
group |
Index of grouping information among the predictors. |
max.steps |
Number of MCMC iterations. Default is 20000. |
n.burn |
Number of burn-in iterations. Default is 10000. |
n.thin |
Lag at which thinning should be done. Default is 1 (no thinning). |
r |
Shape hyperparameter for the Gamma prior on lambda. Default is 1. |
delta |
Rate hyperparameter for the Gamma prior on lambda. Default is 0.1. |
posterior.summary.beta |
Posterior summary measure for beta (mean, median, or mode). Default is 'mean'. |
posterior.summary.lambda |
Posterior summary measure for lambda (mean or median). Default is 'mean'. |
posterior.summary.alpha |
Posterior summary measure for alpha (mean or median) when alpha is unknown. Default is 'mean'. |
beta.ci.level |
Credible interval level for beta. Default is 0.95 (95%). |
lambda.ci.level |
Credible interval level for lambda. Default is 0.95 (95%). |
alpha.ci.level |
Credible interval level for alpha when alpha is unknown. Default is 0.95 (95%). |
seed |
Seed value for reproducibility. Default is 1234. |
alpha.prior |
Prior distribution on alpha when alpha is unknown. Must be one of 'uniform' and 'beta'. |
a |
Beta prior distribution shape parameter 1 when ‘alpha.prior' is ’beta'. Default is 10. |
b |
Beta prior distribution shape parameter 2 when ‘alpha.prior' is ’beta'. Default is 10. |
update.sigma2 |
Whether sigma2 should be updated. Default is TRUE. |
A list containing the following components is returned:
time |
Computational time in minutes. |
beta |
Posterior mean or median estimates of beta. |
lowerbeta |
Lower limit credible interval of beta. |
upperbeta |
Upper limit credible interval of beta. |
lambda |
Posterior mean or median estimates of lambda. |
lowerlambda |
Lower limit credible interval of lambda |
upperlambda |
Upper limit credible interval of lambda |
alpha |
Posterior estimate of alpha if alpha is unknown. |
alphaci |
Posterior credible interval of alpha if alpha is unknown. |
beta.post |
Post-burn-in posterior samples of beta. |
sigma2.post |
Post-burn-in posterior samples of sigma2. |
lambda.post |
Post-burn-in posterior samples of lambda |
alpha.post |
Post-burn-in posterior samples of alpha if alpha is unknown. |
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 | ## Not run:
################################
# Load the Birthweight Dataset #
################################
library(grpreg)
data(birthwt.grpreg) # Hosmer and lemeshow (1989)
x <- scale(as.matrix(birthwt.grpreg[,-c(1,2)]))
y <- birthwt.grpreg$bwt - mean(birthwt.grpreg$bwt)
group <- c(1,1,1,2,2,2,3,3,4,5,5,6,7,8,8,8)
###########################
# Classical Group Bridge #
###########################
fit.gbridge <- gBridge(x, y, group=group)
coef.gbridge<-select(fit.gbridge,'BIC')$beta
coef.gbridge[-1][coef.gbridge[-1]!=0]
###############
# Group LASSO #
###############
fit.glasso <- grpreg(x, y, group=group,penalty='grLasso')
coef.glasso<-select(fit.glasso,'BIC')$beta
coef.glasso[-1][coef.glasso[-1]!=0]
##########################
# Bayesian Group Bridge #
##########################
library(UBR)
fit.BayesGroupBridge<-BayesGroupBridgeSMU(x, y, group = group)
fit.BayesGroupBridge$beta[which(sign(fit.BayesGroupBridge$lowerbeta) == sign(fit.BayesGroupBridge$upperbeta))]
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.