Estimating Weighted Logit Models

This vignette demonstrates an example of how to use the logitr() function with the weights argument to estimate weighted logit models.

The data

This example uses the cars_us data set from Helveston et al. (2015) containing 384 stated choice observations from US car buyers. Conjoint surveys were fielded in 2012 online in the US on Amazon Mechanical Turk and in person at the 2013 Pittsburgh Auto show. Participants were asked to select a vehicle from a set of three alternatives. Each participant answered 15 choice questions.

In the utility models described below, the data variables are represented as follows:

Symbol Variable
$$p$$ The price in US dollars.
$$x_{j}^{\mathrm{hev}}$$ Dummy variable for HEV vehicle type
$$x_{j}^{\mathrm{phev10}}$$ Dummy variable for PHEV10 vehicle type
$$x_{j}^{\mathrm{phev20}}$$ Dummy variable for PHEV20 vehicle type
$$x_{j}^{\mathrm{phev40}}$$ Dummy variable for PHEV40 vehicle type
$$x_{j}^{\mathrm{bev75}}$$ Dummy variable for BEV75 vehicle type
$$x_{j}^{\mathrm{bev100}}$$ Dummy variable for BEV100 vehicle type
$$x_{j}^{\mathrm{bev150}}$$ Dummy variable for BEV150 vehicle type
$$x_{j}^{\mathrm{phevFastcharge}}$$ Dummy variable for if the PHEV has a fast charging capability
$$x_{j}^{\mathrm{bevFastcharge}}$$ Dummy variable for if the BEV has a fast charging capability
$$x_{j}^{\mathrm{opCost}}$$ The vehicle operating costs (cents / mile)
$$x_{j}^{\mathrm{accelTime}}$$ The vehicle 0-60mph acceleration time
$$x_{j}^{\mathrm{american}}$$ Dummy variable for an American brand
$$x_{j}^{\mathrm{japanese}}$$ Dummy variable for a Japanese brand
$$x_{j}^{\mathrm{chinese}}$$ Dummy variable for a Chinese brand
$$x_{j}^{\mathrm{skorean}}$$ Dummy variable for a S. Korean brand

The utility model

In this example, we’ll estimate two versions of the following utility model in the WTP space: one without weights and one with weights. Notation is taken from Helveston et al. (2015):

$\begin{equation} \begin{split} &u_{j} = \lambda (\\ &\omega_1 x_{j}^{\mathrm{hev}} + \omega_2 x_{j}^{\mathrm{phev10}} + \omega_3 x_{j}^{\mathrm{phev20}} + \omega_4 x_{j}^{\mathrm{phev40}} +\\ &\omega_5 x_{j}^{\mathrm{bev75}} + \omega_6 x_{j}^{\mathrm{bev100}} + \omega_7 x_{j}^{\mathrm{bev150}} +\\ &\omega_8 x_{j}^{\mathrm{phevFastcharge}} + \omega_9 x_{j}^{\mathrm{bevFastcharge}} + \omega_{10} x_{j}^{\mathrm{opCost}} + \omega_{11} x_{j}^{\mathrm{accelTime}} +\\ &\omega_{12} x_{j}^{\mathrm{american}} + \omega_{13} x_{j}^{\mathrm{japanese}} + \omega_{14} x_{j}^{\mathrm{chinese}} + \omega_{15} x_{j}^{\mathrm{skorean}} - p_{j}\\ &) +\varepsilon_{j} \end{split} \label{eq:mnlWtpCarsExample} \end{equation}$

where all the $$\omega$$ parameters have units of dollars and $$\lambda$$ is the scale parameter.

Unweighted model

Estimate the unweighted model using the logitr() function. In this example, I have set robust = TRUE since it will also be TRUE in the weighted model:

library("logitr")

mnl_wtp_unweighted <- logitr(
data   = cars_us,
choice = 'choice',
obsID  = 'obsnum',
pars   = c(
'hev', 'phev10', 'phev20', 'phev40', 'bev75', 'bev100', 'bev150',
'american', 'japanese', 'chinese', 'skorean', 'phevFastcharge',
'bevFastcharge','opCost', 'accelTime'),
price = 'price',
modelSpace = 'wtp',
robust = TRUE,
# Since WTP space models are non-convex, run a multistart
numMultiStarts = 10
)

Print a summary of the results:

summary(mnl_wtp_unweighted)
#> =================================================
#> Call:
#> logitr(data = cars_us, obsID = "obsnum", pars = c("hev", "phev10",
#>     "phev20", "phev40", "bev75", "bev100", "bev150", "american",
#>     "japanese", "chinese", "skorean", "phevFastcharge", "bevFastcharge",
#>     "opCost", "accelTime"), price = "price", modelSpace = "wtp",
#>     robust = TRUE, numMultiStarts = 10, choice = "choice")
#>
#> Frequencies of alternatives:
#>       1       2       3
#> 0.34323 0.33507 0.32170
#>
#> Summary Of Multistart Runs:
#>    Log Likelihood Iterations Exit Status
#> 1       -4616.952         26           3
#> 2       -4616.952         30           3
#> 3       -4616.952         31           3
#> 4       -4616.952         34           3
#> 5       -4616.952         36           3
#> 6       -4616.952         31           3
#> 7       -4616.952         36           3
#> 8       -4616.952         30           3
#> 9       -4616.952         37           3
#> 10      -4616.952         33           3
#>
#> Use statusCodes() to view the meaning of each status code
#>
#> Exit Status: 3, Optimization stopped because ftol_rel or ftol_abs was reached.
#>
#> Model Type:     Multinomial Logit
#> Model Space:   Willingness-to-Pay
#> Model Run:                4 of 10
#> Iterations:                    34
#> Elapsed Time:         0h:0m:0.27s
#> Algorithm:         NLOPT_LD_LBFGS
#> Weights Used?:              FALSE
#> Cluster ID:                obsnum
#> Robust?                      TRUE
#>
#> Model Coefficients:
#>                  Estimate Std. Error z-value Pr(>|z|)
#> lambda           0.073878   0.086743  0.8517   0.3944
#> hev              0.806265   1.265897  0.6369   0.5242
#> phev10           1.166364   1.659837  0.7027   0.4822
#> phev20           1.648138   2.176476  0.7573   0.4489
#> phev40           2.580016   2.598904  0.9927   0.3208
#> bev75          -16.046659  13.974054 -1.1483   0.2508
#> bev100         -13.003932  11.297783 -1.1510   0.2497
#> bev150          -9.574449   8.180213 -1.1704   0.2418
#> american         2.344207   1.647268  1.4231   0.1547
#> japanese        -0.374974   1.270779 -0.2951   0.7679
#> chinese        -10.268904   9.786426 -1.0493   0.2940
#> skorean         -6.031561   5.636011 -1.0702   0.2845
#> phevFastcharge   2.879086   2.454254  1.1731   0.2408
#> bevFastcharge    2.919025   2.150587  1.3573   0.1747
#> opCost          -1.636038   1.844037 -0.8872   0.3750
#> accelTime       -1.697021   1.737714 -0.9766   0.3288
#>
#> Log-Likelihood:         -4616.9517805
#> Null Log-Likelihood:    -6328.0067827
#> AIC:                     9265.9035610
#> BIC:                     9372.4426000