Learn R Programming

⚠️There's a newer version (0.3.4) of this package.Take me there.

UPG: Efficient Bayesian modeling of binary and categorical data

UPG offers an all-in-one solution for Bayesian modeling of binary and categorical data. The package can be used to efficiently estimate Bayesian versions of probit, logit, multinomial logit and binomial logit models. In this context, the Bayesian paradigm is especially useful for uncertainty quantification and solving issues related to rare events and (quasi-)perfect separation. In fact, UPG allows for highly efficient posterior sampling in cases with imbalanced data as the implemented algorithms are based on boosted MCMC schemes developed in Frühwirth-Schnatter, Zens and Wagner (2020). The underyling implementation is in C++. Several functions are available for tabulating and visualizing results as well as for prediction exercises.

Installation

UPG is available on CRAN and can be installed as follows:

install.packages("UPG")

Usage

The core function for estimating models is UPG(). Given a suitable outcome vector y and a suitable design matrix X, the four implemented models can be estimated using

  • UPG(y, X, type = "probit") for probit models
  • UPG(y, X, type = "logit") for binary logit models
  • UPG(y, X, type = "mnl") for multinomial logit models
  • UPG(y, X, Ni, type = "binomial") for binomial logit models

where binomial logit models require the number of trials Ni as additional input.

The estimation output can be analyzed using a variety of tools implemented in UPG. To tabulate and visualize the results, summary() and plot() are available. Predictions can be obtained using predict(). Extracting coefficients can be done using coef() and logLik() returns the log-likelihood of the model. Finally, the user has access to a number of MCMC diagnostics via UPG.Diag().

More details and applied examples may be found in the package vignette.

References

Frühwirth-Schnatter, S., Zens, G., & Wagner, H. (2020). Ultimate Pólya Gamma Samplers - Efficient MCMC for possibly imbalanced binary and categorical data. arXiv preprint arXiv:2011.06898.

Copy Link

Version

Install

install.packages('UPG')

Monthly Downloads

708

Version

0.2.2

License

GPL-3

Maintainer

Gregor Zens

Last Published

January 7th, 2021

Functions in UPG (0.2.2)

UPG.Diag.Probit

MCMC Diagnostics for UPG.Probit objects
coef.UPG.Logit

Extract coefficients from UPG.Logit objects
coef.UPG.MNL

Extract coefficients from UPG.MNL objects
UPG.Diag.Binomial

MCMC Diagnostics for UPG.Binomial objects
UPG.Diag.MNL

MCMC Diagnostics for UPG.MNL objects
coef.UPG.Probit

Extract coefficients from UPG.Probit objects
coef.UPG.Binomial

Extract coefficients from UPG.Binomial objects
UPG.Diag

MCMC Diagnostics for UPG.Probit, UPG.Logit, UPG.MNL and UPG.Binomial objects using coda
UPG.Diag.Logit

MCMC Diagnostics for UPG.Logit objects
UPG

Gibbs Sampling for Bayesian discrete choice models
logLik.UPG.Logit

Compute log-likelihoods from UPG.Logit objects
plot.UPG.Logit

Coefficient plots for UPG.Logit objects
logLik.UPG.Binomial

Compute log-likelihoods from UPG.Binomial objects
lfp

Female labor force participation data.
predict.UPG.Logit

Predicted probabilities from UPG.Logit objects
predict.UPG.MNL

Predicted probabilities from UPG.MNL objects
predict.UPG.Binomial

Predicted probabilities from UPG.Binomial objects
print.UPG.Binomial

Print information for UPG.Binomial objects
predict.UPG.Probit

Predicted probabilities from UPG.Probit objects
plot.UPG.Probit

Coefficient plots for UPG.Probit objects
titanic

Grouped Titanic survival data.
logLik.UPG.MNL

Compute log-likelihoods from UPG.MNL objects
plot.UPG.MNL

Coefficient plots for UPG.MNL objects
print.UPG.Probit

Print information for UPG.Probit objects
program

Students program choices.
logLik.UPG.Probit

Compute log-likelihoods from UPG.Probit objects
plot.UPG.Binomial

Coefficient plots for UPG.Binomial objects
summary.UPG.Binomial

Estimation results and tables for UPG.Binomial objects
summary.UPG.Logit

Estimation results and tables for UPG.Logit objects
print.UPG.Logit

Print information for UPG.Logit objects
print.UPG.MNL

Print information for UPG.MNL objects
summary.UPG.MNL

Estimation results and tables for UPG.MNL objects
summary.UPG.Probit

Estimation results and tables for UPG.Probit objects