Skip to content

cran/choicer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

choicer: fast discrete-choice models with a focus on economic applications

Lifecycle: stable R-CMD-check

choicer provides fast estimation of discrete-choice models for applied economics. Likelihoods, analytical gradients and Hessians are implemented in C++ with OpenMP parallelism, scaling efficiently to specifications with many alternative-specific constants. Post-estimation routines return predicted shares, own- and cross-price elasticities, diversion ratios, and the BLP contraction. Supports multinomial logit (MNL), mixed logit (MXL), and nested logit (NL); more models will be added.

Installation

You can install the development version of choicer with:

pak::pkg_install("fpcordeiro/choicer")

Example

Estimate a multinomial logit model and compute elasticities and diversion ratios:

library(choicer)
library(data.table)

# Estimate
fit <- run_mnlogit(
    data = dt,
    id_col = "id",
    alt_col = "alt",
    choice_col = "choice",
    covariate_col = c("x1", "x2")
)

summary(fit)

# Post-estimation
predict(fit, type = "shares")        # predicted market shares
elasticities(fit, elast_var = "x1")  # own- and cross-price elasticities
diversion_ratios(fit)                # diversion ratio matrix

Supported models

Model Function Post-estimation
Multinomial Logit run_mnlogit() predict(), elasticities(), diversion_ratios(), blp()
Mixed Logit run_mxlogit() predict(), elasticities(), diversion_ratios(), blp()
Nested Logit run_nestlogit()

All fitted models support summary(), coef(), vcov(), logLik(), AIC(), BIC(), and nobs().

Alternative packages

There are multiple R packages that offer similar functionalities:

About

❗ This is a read-only mirror of the CRAN R package repository. choicer — Discrete Choice Models for Economic Applications. Homepage: https://github.com/fpcordeiro/choicer Report bugs for this package: https://github.com/fpcordeiro/choicer/issues

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors