UPG | R Documentation |
UPG
estimates Bayesian regression models for binary or categorical outcomes using samplers based on marginal data augmentation.
UPG(y,
X,
model,
Ni = NULL,
baseline = NULL,
draws = 1000,
burnin = 1000,
A0 = 4,
B0 = 4,
d0 = 2.5,
D0 = 1.5,
G0 = 100,
verbose = TRUE,
gamma.boost = TRUE,
delta.boost = TRUE,
beta.start = NULL)
y |
a binary vector for probit and logit models. A character, factor or numeric vector for multinomial logit models. A numerical vector of the number of successes for the binomial model. |
X |
a matrix of explanatory variables including an intercept in the first column. Rows are individuals, columns are variables. |
model |
indicates the model to be estimated. |
Ni |
a vector containing the number of trials when estimating a binomial logit model. |
baseline |
a string that can be used to change the baseline category in MNL models. Default baseline is the most commonly observed category. |
draws |
number of saved Gibbs sampler iterations. Default is 1000 for illustration purposes, you should use more when estimating a model (e.g. 10,000). |
burnin |
number of burned Gibbs sampler iterations. Default is 1000 for illustration purposes, you should use more when estimating a model (e.g. 2,000). |
A0 |
prior variance for the intercept, 4 is the default. |
B0 |
prior variance for the coefficients, 4 is the default. |
d0 |
prior shape for working parameter delta, 2.5 is the default. |
D0 |
prior rate for working parameter delta, 1.5 is the default. |
G0 |
prior variance for working parameter gamma, 100 is the default. |
verbose |
logical variable indicating whether progress should be printed during estimation. |
gamma.boost |
logical variable indicating whether location-based parameter expansion boosting should be used. |
delta.boost |
logical variable indicating whether scale-based parameter expansion boosting should be used. |
beta.start |
provides starting values for beta (e.g. for use within Gibbs sampler). Baseline coefficients need to be zero for multinomial model. |
Depending on the estimated model, UPG()
returns a UPG.Probit
, UPG.Logit
, UPG.MNL
or UPG.Binomial
object.
Gregor Zens
summary.UPG.Probit
to summarize a UPG.Probit
object and to create tables.
predict.UPG.Logit
to predict probabilities using a UPG.Logit
object.
plot.UPG.MNL
to plot a UPG.MNL
object.
# load package
library(UPG)
# estimate a probit model using example data
# warning: use more burn-ins, burnin = 100 is just used for demonstration purposes
data(lfp)
y = lfp[,1]
X = lfp[,-1]
results.probit = UPG(y = y, X = X, model = "probit", burnin = 100)
# estimate a logit model using example data
# warning: use more burn-ins, burnin = 100 is just used for demonstration purposes
data(lfp)
y = lfp[,1]
X = lfp[,-1]
results.logit = UPG(y = y, X = X, model = "logit", burnin = 100)
# estimate a MNL model using example data
# warning: use more burn-ins, burnin = 100 is just used for demonstration purposes
data(program)
y = program[,1]
X = program[,-1]
results.mnl = UPG(y = y, X = X, model = "mnl", burnin = 100)
# estimate a binomial logit model using example data
# warning: use more burn-ins, burnin = 100 is just used for demonstration purposes
data(titanic)
y = titanic[,1]
Ni = titanic[,2]
X = titanic[,-c(1,2)]
results.binomial = UPG(y = y, X = X, Ni = Ni, model = "binomial", burnin = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.