Learn R Programming

logitr

logitr: Fast Estimation of Multinomial (MNL) and Mixed Logit (MXL) Models with Preference Space and Willingness to Pay Space Utility Parameterizations

The latest version includes support for:

  • Multinomial logit (MNL) models
  • Mixed logit (MXL) models with normal and log-normal parameter distributions.
  • Preference space and WTP space utility parameterizations.
  • Weighted models to differentially weight individual observations.
  • Uncorrelated or correlated heterogeneity covariances for mixed logit models.
  • Functions for computing WTP from preference space models.
  • Functions for predicting expected probabilities and outcomes for sets of alternatives based on an estimated model.
  • A parallelized multistart optimization loop that uses different random starting points in each iteration to search for different local minima (useful for non-convex problems like MXL models or models with WTP space parameterizations).

Mixed logit models are estimated using maximum simulated likelihood based on the algorithms in Kenneth Train’s book Discrete Choice Methods with Simulation, 2nd Edition (New York: Cambridge University Press, 2009).

Basic Usage

View the basic usage page for details on how to use logitr to estimate models.

JSS Article

An associated paper in the Journal of Statistical Software about this package is available at https://doi.org/10.18637/jss.v105.i10

Installation

You can install {logitr} from CRAN:

install.packages("logitr")

or you can install the development version of {logitr} from GitHub:

# install.packages("remotes")
remotes::install_github("jhelvy/logitr")

Load the library with:

library(logitr)

Author, Version, and License Information

Citation Information

If you use this package for in a publication, please cite the JSS article associated with it! You can get the citation by typing citation("logitr") into R:

citation("logitr")
#> 
#> To cite logitr in publications use:
#> 
#>   Helveston JP (2023). "logitr: Fast Estimation of Multinomial and
#>   Mixed Logit Models with Preference Space and Willingness-to-Pay Space
#>   Utility Parameterizations." _Journal of Statistical Software_,
#>   *105*(10), 1-37. doi:10.18637/jss.v105.i10
#>   <https://doi.org/10.18637/jss.v105.i10>.
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Article{,
#>     title = {{logitr}: Fast Estimation of Multinomial and Mixed Logit Models with Preference Space and Willingness-to-Pay Space Utility Parameterizations},
#>     author = {John Paul Helveston},
#>     journal = {Journal of Statistical Software},
#>     year = {2023},
#>     volume = {105},
#>     number = {10},
#>     pages = {1--37},
#>     doi = {10.18637/jss.v105.i10},
#>   }

Copy Link

Version

Install

install.packages('logitr')

Monthly Downloads

3,526

Version

1.1.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

John Helveston

Last Published

July 24th, 2024

Functions in logitr (1.1.2)

predictProbs

Predict expected choice probabilities
logitr

The main function for estimating logit models
predict.logitr

Predict probabilities and / or outcomes
model.matrix.logitr

Construct Design Matrices
recodeData

Returns a list of the design matrix X and updated pars and randPars to include any dummy-coded categorical or interaction variables.
model.frame.logitr

Extracting the Model Frame from a Formula or Fit
glance.logitr

Glance a logitr class object
runtimes

Data frame of run times for logitr benchmark
vcov.logitr

Calculate the variance-covariance matrix
tidy.logitr

Tidy a logitr class object
logit_probs

Compute logit fraction for sets of alternatives given coefficient draws
predictChoices

Predict choices
statusCodes

View a description the nloptr status codes
se

Extract standard errors
se.logitr

Extract standard errors
wtpCompare

Compare WTP from preference and WTP space models
miscmethods.logitr

Methods for logitr objects
simulateShares

Simulate expected shares
wtp.logitr

Get WTP estimates a preference space model
wtp

Get WTP estimates a preference space model
reexports

Objects exported from other packages
residuals.logitr

Extract Model Residuals
yogurt

Choice observations of yogurt purchases by 100 households
cars_china

Stated car choice observations by Chinese car buyers
electricity

Stated preference data for the choice of electricity suppliers (from mlogit package)
ci

Obtain a confidence interval from coefficient draws
fquantile

Predict probabilities and / or outcomes
augment.logitr

Glance a logitr class object
dummyCode

Add dummy-coded variables to data frame.
apolloModeChoiceData

Simulated SP dataset of mode choice (from the apollo package).
cars_us

Stated car choice observations by US car buyers
fitted.logitr

Extract Model Fitted Values
confint.logitr

Extract Model Confidence Interval