Description Usage Arguments Details Value Author(s) References Examples
Use Gibbs sampler with Polya-Gamma data augmentation to fit logistic and probit regression under independent Student-t priors (including Cauchy priors and normal priors as special cases).
1 2 3 4 5 |
y |
a numerical vector of length n. Binary responses. |
X |
an n by p matrix. Design matrix, not including the intercept. |
iter |
total number of iterations of MCMC. |
thin |
thinning; save one iteration in every |
burnin |
ratio between number of burnin iterations and total number of iterations. |
method |
|
df |
degree freedom of the independent Student-t priors on both intercept and slopes.
If |
slope.scale |
a scalar or a vector of length p. The scale (or standard deviation) parameter of the Student-t (or normal) priors on slopes. |
intercept.scale |
the scale (or sd) parameter of the Student-t (or normal) prior on the intercept. |
save.latent |
logical, indicating whether to save the MCMC samples for the latent variable z. Since latent variable is of length n, it takes a lot of space when n is large. |
center.binary |
logical, indicating whether to center binary predictors. |
scale.continuous |
logical, indicating whether to center and rescale the non-binary predictors. |
beta.original |
logical, indicating whether to post-process the posterior samples of beta to the orginal scale. This is only meaningful if predictors are centered/rescaled in the pre-processing step. |
track.time |
logical, indicating whether to show process time. |
show.summary |
logical, indicating whether to show summary of posterior inferences. |
See references.
Beta |
a |
Gamma |
a |
Inference |
a (p + 1) by 4 matrix. Sample posterior mean, stanard deviation, and 95% HDP interval for the intercept and coefficients. |
Z |
a |
Yingbo Li
Maintainer: Yingbo Li <ybli@clemson.edu>
James H. Albert and Siddhartha Chib. (1993) "Bayesian Analysis of Binary and Polychotomous Response Data." Journal of the American statistical Association, 88(422), 669-679.
Nicholas G. Polson, James G. Scott, and Jesse Windle. (2013) "Bayesian Inference for Logistic Models Using Polya-Gamma Latent Variables." Journal of the American statistical Association, 108(504), 1339-1349.
Joyee Ghosh, Yingbo Li, and Robin Mitra. "On the Use of Cauchy Prior Distributions for Bayesian Logistic Regression." Working paper.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## create a dataset for logistic regression
n = 200; p = 2; beta0 = c(0.5, 1, 2);
X = matrix(rnorm(n * p), ncol = p);
p = 1 / (1 + exp(- beta0[1] - X %*% beta0[-1]));
y = rbinom(n, 1, prob = p);
## Cauchy priors
results.cauchy = tglm.fit(y, X, iter = 1e3);
## Not run: ##
#### Student-t priors with df = 7
## results.t7 = tglm.fit(y, X, iter = 1e3, df = 7);
#### Normal priors
##results.normal = tglm.fit(y, X, iter = 1e3, df = Inf);
#### Probit regression
##results.probit = tglm.fit(y, X, iter = 1e3, method = 'probit');
## End(Not run)
|
10% completed...
20% completed...
30% completed...
40% completed...
50% completed...
60% completed...
70% completed...
80% completed...
90% completed...
100% completed.
Time used (in second):
user system elapsed
0.598 0.000 0.643
Posterior inference:
Est Std 95HPDlower 95HPDupper
intercept 0.5876 0.1959 0.2141 0.9514
X1 1.1876 0.2592 0.7234 1.7118
X2 1.8316 0.3208 1.2443 2.4582
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.