Package: logitr 1.1.3

logitr: Logit Models w/Preference & WTP Space Utility Parameterizations

Fast estimation of multinomial (MNL) and mixed logit (MXL) models in R. Models can be estimated using "Preference" space or "Willingness-to-pay" (WTP) space utility parameterizations. Weighted models can also be estimated. An option is available to run a parallelized multistart optimization loop with random starting points in each iteration, which is useful for non-convex problems like MXL models or models with WTP space utility parameterizations. The main optimization loop uses the 'nloptr' package to minimize the negative log-likelihood function. Additional functions are available for computing and comparing WTP from both preference space and WTP space models and for predicting expected choices and choice probabilities for sets of alternatives based on an estimated model. Mixed logit models can include uncorrelated or correlated heterogeneity covariances and are estimated using maximum simulated likelihood based on the algorithms in Train (2009) <doi:10.1017/CBO9780511805271>. More details can be found in Helveston (2023) <doi:10.18637/jss.v105.i10>.

Authors:John Helveston [aut, cre, cph], Connor Forsythe [ctb]

logitr_1.1.3.tar.gz
logitr_1.1.3.zip(r-4.7)logitr_1.1.3.zip(r-4.6)logitr_1.1.3.zip(r-4.5)
logitr_1.1.3.tgz(r-4.6-any)logitr_1.1.3.tgz(r-4.5-any)
logitr_1.1.3.tar.gz(r-4.7-any)logitr_1.1.3.tar.gz(r-4.6-any)
logitr_1.1.3.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
logitr/json (API)

# Install 'logitr' in R:
install.packages('logitr', repos = c('https://jhelvy.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/jhelvy/logitr/issues

Datasets:
  • apolloModeChoiceData - Simulated SP dataset of mode choice (from the apollo package).
  • cars_china - Stated car choice observations by Chinese car buyers
  • cars_us - Stated car choice observations by US car buyers
  • electricity - Stated preference data for the choice of electricity suppliers
  • runtimes - Data frame of run times for logitr benchmark
  • yogurt - Choice observations of yogurt purchases by 100 households

On CRAN:

Conda:

log-likelihoodlogitlogit-modelmixed-logitmlogitmultinomial-regressionmxlmxl-modelspreference-spacepreferenceswillingness-to-paywtp

9.72 score 63 stars 1 packages 197 scripts 6.5k downloads 17 exports 15 dependencies

Last updated from:fd0fd363c4. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK225
source / vignettesOK246
linux-release-x86_64OK179
macos-release-arm64OK133
macos-oldrel-arm64OK152
windows-develOK136
windows-releaseOK163
windows-oldrelOK142
wasm-releaseOK130

Exports:augmentcidummyCodefquantileglancelogit_probslogitrpredictChoicespredictProbsrecodeDatasesimulateSharesstatusCodestidyvalidate_datawtpwtpCompare

Dependencies:cligenericsgluelifecyclemagrittrMASSnloptrpillarpkgconfigrandtoolboxrlangrngWELLtibbleutf8vctrs

Utility Models in the Preference & WTP Space
The random utility model in two spaces | References

Last update: 2025-12-19
Started: 2020-10-22

Data Formatting and Encoding
Basic required format | Continuous versus discrete variables | Creating dummy coded variables | Validating data before estimation | Basic validation | Validation with parameters | Panel data validation | Common errors detected

Last update: 2025-11-14
Started: 2020-12-06

WTP space convergence issues in other packages
Setup | Basic settings | Package-specific settings | Prep for | Prep for | Prep for | Estimate WTP space models

Last update: 2023-09-24
Started: 2022-10-04

Predicting Probabilities and Outcomes with Estimated Models
Predicting probabilities | Preference space models | WTP space models | Predicting outcomes | References

Last update: 2023-05-17
Started: 2021-10-25

Basic Usage
Data format | Model specification interface | Parallelized multi-start estimation | Mixed logit models | Viewing results | Computing and comparing WTP | Predicting probabilities and outcomes

Last update: 2022-10-04
Started: 2020-10-22

Estimating Mixed Logit Models
Supported distributions | The data | Preference space model | WTP space model | Correlated heterogeneity | References

Last update: 2022-10-04
Started: 2020-10-21

Summarizing Results
Extracting summary tables | The {broom} package | Extracting other values | Formatted summary tables | The {gtsummary} package | The {texreg} package

Last update: 2022-10-04
Started: 2022-10-04

Benchmarking estimation speed against other packages
Comparing run times

Last update: 2022-06-16
Started: 2022-06-16

Estimating Multinomial Logit Models
The data | Preference space model | WTP space model | Compare WTP from both models | References

Last update: 2022-06-16
Started: 2020-10-22

Estimating Weighted Logit Models
The data | The utility model | Unweighted model | Weighted model | Compare results | References

Last update: 2022-06-16
Started: 2020-12-06

Estimating Models with Interactions
Interactions with continuous variables | Interactions with discrete variables | Interactions with individual-specific variables | Interactions in mixed logit models

Last update: 2021-10-25
Started: 2020-12-06

Readme and manuals

Help Manual

Help pageTopics
Simulated SP dataset of mode choice (from the apollo package).apolloModeChoiceData
Glance a 'logitr' class objectaugment.logitr
Stated car choice observations by Chinese car buyerscars_china
Stated car choice observations by US car buyerscars_us
Obtain a confidence interval from coefficient drawsci
Extract Model Confidence Intervalconfint.logitr
Stated preference data for the choice of electricity suppliers (from mlogit package)electricity
Extract Model Fitted Valuesfitted.logitr
Predict probabilities and / or outcomesfquantile
Glance a 'logitr' class objectglance.logitr
Compute logit fraction for sets of alternatives given coefficient drawslogit_probs
The main function for estimating logit modelslogitr
Methods for logitr objectscoef.logitr coef.summary.logitr logLik.logitr miscmethods.logitr print.logitr print.logitr_validation print.logitr_wtp print.summary.logitr summary.logitr terms.logitr
Extracting the Model Frame from a Formula or Fitmodel.frame.logitr
Construct Design Matricesmodel.matrix.logitr
Predict probabilities and / or outcomespredict.logitr
Returns a list of the design matrix 'X' and updated 'pars' and 'randPars' to include any dummy-coded categorical or interaction variables.recodeData
Extract Model Residualsresiduals.logitr
Data frame of run times for logitr benchmarkruntimes
Extract standard errorsse
Extract standard errorsse.logitr
View a description the nloptr status codesstatusCodes
Tidy a 'logitr' class objecttidy.logitr
Validate data formatting for logitr modelsvalidate_data
Calculate the variance-covariance matrixvcov.logitr
Get WTP estimates a preference space modelwtp
Get WTP estimates a preference space modelwtp.logitr
Compare WTP from preference and WTP space modelswtpCompare
Choice observations of yogurt purchases by 100 householdsyogurt