Learn R Programming

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

logitr

This package estimates multinomial (MNL) and mixed logit (MXL) models in R. Models can be estimated using “Preference” space or “Willingness-to-pay” (WTP) space utility parameterizations.

The latest version includes support for:

  • Homogeneous multinomial logit (MNL) models
  • Heterogeneous mixed logit (MXL) models (with normal and log-normal parameter distributions).
  • Preference space utility parameterization.
  • WTP space utility parameterization.
  • An option to run a multistart optimization loop that uses different random starting points in each iteration (useful for non-convex problems like MXL models or models with WTP space parameterizations).
  • Computing and comparing WTP from both preference space and WTP space models.
  • Simulating the expected shares of a set of alternatives using an estimated model.

Note: MXL models assume uncorrelated heterogeneity covariances and 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).

Installation

The current version is not yet on CRAN, but you can install it from GitHub using the devtools library:

devtools::install_github("jhelvy/logitr")

Load the library with:

library(logitr)

Basic Usage

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

Author, Version, and License Information

  • Author: John Paul Helveston www.jhelvy.com
  • Date First Written: Sunday, September 28, 2014
  • Most Recent Update: January 14, 2021
  • License: MIT

Citation Information

If you use this package for in a publication, I would greatly appreciate it if you cited it - you can get the citation by typing citation("logitr") into R:

citation("logitr")
#> 
#> To cite logitr in publications use:
#> 
#>   John Paul Helveston (2021). logitr: Random utility logit models with
#>   preference and willingness to pay space parameterizations. R package
#>   version 0.1.0.
#> 
#> A BibTeX entry for LaTeX users is
#> 
#>   @Manual{,
#>     title = {logitr: Random Utility Logit Models with Preference and Willingness to Pay Space Parameterizations},
#>     author = {John Paul Helveston},
#>     year = {2020},
#>     note = {R package version 0.1.0},
#>     url = {https://jhelvy.github.io/logitr/},
#>   }

Copy Link

Version

Install

install.packages('logitr')

Monthly Downloads

3,526

Version

0.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

John Helveston

Last Published

January 19th, 2021

Functions in logitr (0.1.0)

recodeData

Recode a data frame to create dummy-coded categorical and interaction variables.
coef.logitr

Get the model coefficients
dummyCode

Creates dummy-coded variables.
statusCodes

View a description the nloptr status codes
getCoefTable

Get the coefficient summary table as a data frame
logitr

The main function for estimating logit models
cars_us

Stated car choice observations by US car buyers
cars_china

Stated car choice observations by Chinese car buyers
summary.logitr

View summary of estimated model
wtp

Get WTP from a preference space model
simulateShares

Simulate expected shares from a set of alternatives
yogurt

Choice observations of yogurt purchases by 100 households
wtpCompare

Compare WTP from preference and WTP space models