---
title: "Utility Models in the Preference & WTP Space"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Utility Models in the Preference & WTP Space}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}
bibliography: "`r here::here('vignettes', 'library.bib')`"
---

```{r, child='../man/rmdchunks/header.Rmd'}
```

In many applications of discrete choice models, modelers are interested in estimating consumer's marginal "willingness-to-pay" (WTP) for different attributes. WTP can be estimated in two ways:

1. Estimate a discrete choice model in the "preference space" where parameters have units of utility and then compute the WTP by dividing the parameters by the price parameter.
2. Estimate a discrete choice model in the "WTP space" where parameters have units of WTP.

While the two procedures generally produce the same estimates of WTP for homogenous models, the same is not true for heterogeneous models where model parameters are assumed to follow a specific distribution, such as normal or log-normal [@Train2005]. For example, in a preference space specification, a normally distributed attribute parameter divided by a log-normally distributed price parameter produces a strange WTP distribution with large tails. In contrast, a WTP space specification allows the modeler to directly assume WTP is normally distributed. The \pkg{logitr} package was developed to enable modelers to choose between these two utility spaces when estimating multinomial logit models.

# The random utility model in two spaces

The random utility model is a well-established framework in many fields for estimating consumer preferences from observed consumer choices [@Louviere2000; @Train2009]. Random utility models assume that consumers choose the alternative $j$ a set of alternatives that has the greatest utility $u_{j}$. Utility is a random variable that is modeled as $u_{j} = v_{j} + \varepsilon_{j}$, where $v_{j}$ is the "observed utility" (a function of the observed attributes such that $v_{j} = f(\xVec_{j})$) and $\varepsilon_{j}$ is a random variable representing the portion of utility unobservable to the modeler.

Adopting the same notation as in Helveston et al. [-@Helveston2018], consider the following utility model:

```{r, child='../man/rmdchunks/utility.Rmd'}
```

where $\betaVec^{*}$ is the vector of coefficients for non-price attributes $\xVec_{j}$, $\alpha^{*}$ is the coefficient for price $p_{j}$, and the error term, $\varepsilon^{*}_{j}$, is an IID random variable with a Gumbel extreme value distribution of mean zero and variance $\sigma^2(\pi^2/6)$. This model is not identified since there exists an infinite set of combinations of values for $\betaVec^{*}$, $\alpha^{*}$, and $\sigma$ that produce the same choice probabilities. In order to specify an identifiable model, the modeler must normalize equation (\ref{eq:utility}). One approach is to normalize the scale of the error term by dividing equation (\ref{eq:utility}) by $\sigma$, producing the "preference space" utility specification:

```{r, child='../man/rmdchunks/utilityPreferenceScaled.Rmd'}
```

The typical preference space parameterization of the multinomial logit (MNL) model can then be written by rewriting equation (\ref{eq:utilityPreferenceScaled}) with $u_j = (u^*_j / \sigma)$, $\betaVec = (\betaVec^{*} / \sigma)$, $\alpha = (\alpha^{*} / \sigma)$, and $\varepsilon_{j} = (\varepsilon^{*}_{j} / \sigma)$:

```{r, child='../man/rmdchunks/utilityPreference.Rmd'}
```

The vector $\betaVec$ represents the marginal utility for changes in each non-price attribute, and $\alpha$ represents the marginal utility obtained from price reductions. In addition, the coefficients $\betaVec$ and $\alpha$ are measured in units of *utility*, which only has relative rather than absolute meaning.

The alternative normalization approach is to normalize equation (\ref{eq:utility}) by $- \alpha^*$ instead of $\sigma$, producing the "willingness-to-pay (WTP) space" utility specification:

```{r, child='../man/rmdchunks/utilityWtpScaled.Rmd'}
```

Since the error term in equation is scaled by $\lambda^2 = \sigma^2/(- \alpha^{*})^2$, we can rewrite equation (\ref{eq:utilityWtpScaled}) by multiplying both sides by $\lambda= (- \alpha^{*} / \sigma$) and renaming $u_j = (\lambda u^*_j /- \alpha^*)$, $\omegaVec = (\betaVec^{*} /- \alpha^{*}$), and $\varepsilon_j = (\lambda \varepsilon^*_j / - \alpha^*)$:

```{r, child='../man/rmdchunks/utilityWtp.Rmd'}
```

Here $\omegaVec$ represents the marginal WTP for changes in each non-price attribute, and $\lambda$ represents the scale of the deterministic portion of utility relative to the standardized scale of the random error term.

The utility models in equations \ref{eq:utilityPreference} and \ref{eq:utilityWtp} represent the preference space and WTP space utility specifications, respectively. In equation \ref{eq:utilityPreference}, WTP is estimated as $\hat{\betaVec} / \hat{- \alpha}$; in equation \ref{eq:utilityWtp}, WTP is simply $\hat{\omegaVec}$.

# References
