## Random utility model

The utility for alternative \(l\) is written as: \(U_l=V_l+\epsilon_l\) where \(V_l\) is a function of some observable covariates and unknown parameters to be estimated, and \(\epsilon_l\) is a random deviate which contains all the unobserved determinants of the utility. Alternative \(l\) is therefore chosen if \(\epsilon_j < (V_l-V_j)+\epsilon_l \;\forall\;j\neq l\) and the probability of choosing this alternative is then:

\[ \mbox{P}(\epsilon_1 < V_l-V_1+\epsilon_l, \epsilon_2 < V_l-V_2+\epsilon_l, ..., \epsilon_J < V_l-V_J+\epsilon_l). \]

Denoting \(F_{-l}\) the cumulative density function of all the \(\epsilon\)s except \(\epsilon_l\), this probability is:

\[\begin{equation*} (\mbox{P}_l \mid \epsilon_l)= F_{-l}(V_l-V_1+\epsilon_l, ..., V_l-V_J+\epsilon_l). \end{equation*}\]

Note that this probability is conditional on the value of \(\epsilon_l\). The unconditional probability (which depends only on \(\beta\) and on the value of the observed explanatory variables) is obtained by integrating out the conditional probability using the marginal density of \(\epsilon_l\), denoted \(f_l\):

\[\begin{equation*} \mbox{P}_l=\int F_{-l}(V_l-V_1+\epsilon_l, ...,V_l-V_J)+\epsilon_l)f_l(\epsilon_l) d\epsilon_l. \end{equation*}\]

The conditional probability is an integral of dimension \(J-1\) and the computation of the unconditional probability adds on more dimension of integration.

## The distribution of the error terms

The multinomial logit model (McFadden 1974) is a special case of the model developed in the previous section. It is based on three hypothesis.

The first hypothesis is the independence of the errors. In this case, the univariate distribution of the errors can be used, which leads to the following conditional and unconditional probabilities:

\[\begin{equation*} (\mbox{P}_l \mid \epsilon_l)=\prod_{j\neq l}F_j(V_l-V_j+\epsilon_l) \mbox{ and } \mbox{P}_l =\int \prod_{j\neq l}F_j(V_l-V_j+\epsilon_l) \; f_l(\epsilon_l) \;d\epsilon_l, \end{equation*}\]

which means that the conditional probability is the product of \(J-1\) univariate cumulative density functions and the evaluation of only a one-dimensional integral is required to compute the unconditional probability.

The second hypothesis is that each \(\epsilon\) follows a Gumbel distribution, whose density and probability functions are respectively:

\[\begin{equation} f(z)=\frac{1}{\theta}e^{-\frac{z-\mu}{\theta}} e^{-e^{-\frac{z-\mu}{\theta}}} \mbox{ and } F(z)=\int_{-\infty}^{z} f(t) dt=e^{-e^{-\frac{z-\mu}{\theta}}}, \end{equation}\]

where \(\mu\) is the location parameter and \(\theta\) the scale parameter. The first two moments of the Gumbel distribution are \(\mbox{E}(z)=\mu+\theta \gamma\), where \(\gamma\) is the Euler-Mascheroni constant (\(\approx 0.577\)) and \(\mbox{V}(z)=\frac{\pi^2}{6}\theta^2\). The mean of \(\epsilon_j\) is not identified if \(V_j\) contains an intercept. We can then, without loss of generality suppose that \(\mu_j=0, \; \forall j\). Moreover, the overall scale of utility is not identified. Therefore, only \(J-1\) scale parameters may be identified, and a natural choice of normalization is to impose that one of the \(\theta_j\) is equal to 1.

The last hypothesis is that the errors are identically distributed. As the location parameter is not identified for any error term, this hypothesis is essentially an homoscedasticity hypothesis, which means that the scale parameter of the Gumbel distribution is the same for all the alternatives. As one of them has been previously set to 1, we can therefore suppose that, without loss of generality, \(\theta_j = 1, \;\forall j \in 1... J\). The conditional and unconditional probabilities then further simplify to:

\[\begin{equation*} (\mbox{P}_l \mid \epsilon_l)%=\prod_{j\neq l}F(V_l-V_j+\epsilon_l) =\prod_{j\neq l}e^{-e^{-(V_l-Vj+\epsilon_l)}} \mbox{ and } \mbox{P}_l =\int_{-\infty}^{+\infty}\prod_{j\neq l}e^{-e^{-(V_l-Vj+t)}}e^{-t}e^{-e^{-t}}dt. \end{equation*}\]

The probabilities have then very simple, closed forms, which correspond to the logit transformation of the deterministic part of the utility.

\[\begin{equation*} P_l=\frac{e^{V_l}}{\sum_{j=1}^J e^{V_j}}. \end{equation*}\]

## IIA property

If we consider the probabilities of choice for two alternatives \(l\) and \(m\), we have \(P_l=\frac{e^{V_l}}{\sum_j e^{V_j}}\) and \(P_m=\frac{e^{V_m}}{\sum_j e^{V_j}}\). The ratio of these two probabilities is:

\[ \frac{P_l}{P_m}=\frac{e^{V_l}}{e^{V_m}}=e^{V_l-V_m}. \]

This probability ratio for the two alternatives depends only on the characteristics of these two alternatives and not on those of other alternatives. This is called the IIA property (for independence of irrelevant alternatives). IIA relies on the hypothesis that the errors are identical and independent. It is not a problem by itself and may even be considered as a useful feature for a well specified model. However, this hypothesis may be in practice violated, especially if some important variables are omitted.

## Interpretation

In a linear model, the coefficients are the marginal effects of the explanatory variables on the explained variable. This is not the case for the multinomial logit model. However, meaningful results can be obtained using relevant transformations of the coefficients.

### Marginal effects

The marginal effects are the derivatives of the probabilities with respect to the covariates, which can be be choice situation-specific (\(z_i\)) or alternative specific (\(x_{ij}\)):

\[ \begin{array}{rcl} \displaystyle \frac{\partial P_{il}}{\partial z_{i}}&=&P_{il}\left(\beta_l-\sum_j P_{ij}\beta_j\right) \\ \displaystyle \frac{\partial P_{il}}{\partial x_{il}}&=&\gamma P_{il}(1-P_{il})\\ \displaystyle \frac{\partial P_{il}}{\partial x_{ik}}&=&-\gamma P_{il}P_{ik}. \end{array} \]

- For a choice situation specific variable, the sign of the marginal effect is not necessarily the sign of the coefficient. Actually, the sign of the marginal effect is given by \(\left(\beta_l-\sum_j P_{ij}\beta_j\right)\), which is positive if the coefficient for alternative \(l\) is greater than a weighted average of the coefficients for all the alternatives, the weights being the probabilities of choosing the alternatives. In this case, the sign of the marginal effect can be established with no ambiguity only for the alternatives with the lowest and the greatest coefficients.

- For an alternative-specific variable, the sign of the coefficient can be directly interpreted. The marginal effect is obtained by multiplying the coefficient by the product of two probabilities which is at most 0.25. The rule of thumb is therefore to divide the coefficient by 4 in order to have an upper bound of the marginal effect.

Note that the last equation can be rewritten: \(\frac{\mbox{d} P_{il} / P_{il}}{\mbox{d}x_{ik}} = -\gamma P_{ik}\). Therefore, when a characteristic of alternative \(k\) changes, the relative change of the probabilities for every alternatives except \(k\) are the same, which is a consequence of the IIA property.

### Marginal rates of substitution

Coefficients are marginal utilities, which cannot be interpreted. However, ratios of coefficients are marginal rates of substitution. For example, if the observable part of utility is: \(V=\beta_o +\beta_1 x_1 +\beta x_2 + \beta x_3\), join variations of \(x_1\) and \(x_2\) which ensure the same level of utility are such that: \(dV=\beta_1 dx_1+\beta_2 dx_2=0\) so that:

\[ - \frac{dx_2}{dx_1}\mid_{dV = 0} = \frac{\beta_1}{\beta_2}. \]

For example, if \(x_2\) is transport cost (in $), \(x_1\) transport time (in hours), \(\beta_1 = 1.5\) and \(\beta_2=0.2\), \(\frac{\beta_1}{\beta_2}=30\) is the marginal rate of substitution of time in terms of $ and the value of 30 means that to reduce the travel time of one hour, the individual is willing to pay at most 30$ more. Stated more simply, time value is 30$ per hour.

### Consumer’s surplus

Consumer’s surplus has a very simple expression for multinomial logit models, which was first derived by Small and Rosen (1981). The level of utility attained by an individual is \(U_j=V_j+\epsilon_j\), \(j\) being the chosen alternative. The expected utility, from the searcher’s point of view is then: \(\mbox{E}(\max_j U_j)\), where the expectation is taken over the values of all the error terms. Its expression is simply, up to an additive unknown constant, the log of the denominator of the logit probabilities, often called the “log-sum”:

\[ \mbox{E}(U)=\ln \sum_{j=1}^Je^{V_j}+C. \]

If the marginal utility of income (\(\alpha\)) is known and constant, the expected surplus is simply \(\frac{\mbox{E}(U)}{\alpha}\).

## Application

Random utility models are fitted using the `mlogit` function. Basically, only two arguments are mandatory, `formula` and `data`, if an `dfidx` object (and not an ordinary `data.frame`) is provided.

### ModeCanada

We first use the `ModeCanada` data set, which was already coerced to a `dfidx` object (called `MC`) in the previous section. The same model can then be estimated using as `data` argument this `dfidx` object:

    library(mlogit)
    MC <- dfidx(ModeCanada, subset = noalt == 4)
    ml.MC1 <- mlogit(choice ~ cost + freq + ovt | income | ivt, MC)

or a `data.frame`. In this latter case, further arguments that will be passed to `dfidx` should be indicated:

    ml.MC1b <- mlogit(choice ~ cost + freq + ovt | income | ivt, ModeCanada,
                      subset = noalt == 4, idx = c("case", "alt"))

`mlogit` provides two further useful arguments:

- `reflevel` indicates which alternative is the “reference” alternative, i.e., the one for which the coefficients of choice situation specific covariates are set to 0,
- `alt.subset` indicates a subset of alternatives on which the estimation has to be performed; in this case, only the lines that correspond to the selected alternatives are used and all the choice situations where not selected alternatives has been chosen are removed.

We estimate the model on the subset of three alternatives (we exclude `bus` whose market share is negligible in our sample) and we set `car` as the reference alternative. Moreover, we use a total transport time variable computed as the sum of the in vehicle and the out of vehicle time variables.

    MC$time <- with(MC, ivt + ovt)
    ml.MC1 <- mlogit(choice ~ cost + freq | income | time, MC,
                     alt.subset = c("car", "train", "air"),
                     reflevel = "car")

The main results of the model are computed and displayed using the `summary` method:

    summary(ml.MC1)

    Call:
    mlogit(formula = choice ~ cost + freq | income | time, data = MC,
        alt.subset = c("car", "train", "air"), reflevel = "car",
        method = "nr")

    Frequencies of alternatives:choice
        car   train     air
    0.45757 0.16721 0.37523

    nr method
    6 iterations, 0h:0m:0s
    g'(-H)^-1g = 6.94E-06
    successive function values within tolerance limits

    Coefficients :
                         Estimate  Std. Error  z-value  Pr(>|z|)
    (Intercept):train -0.97034440  0.26513065  -3.6599 0.0002523 ***
    (Intercept):air   -1.89856552  0.68414300  -2.7751 0.0055185 **
    cost              -0.02849715  0.00655909  -4.3447 1.395e-05 ***
    freq               0.07402902  0.00473270  15.6420 < 2.2e-16 ***
    income:train      -0.00646892  0.00310366  -2.0843 0.0371342 *
    income:air         0.02824632  0.00365435   7.7295 1.088e-14 ***
    time:car          -0.01402405  0.00138047 -10.1589 < 2.2e-16 ***
    time:train        -0.01096877  0.00081834 -13.4036 < 2.2e-16 ***
    time:air          -0.01755120  0.00399181  -4.3968 1.099e-05 ***
    ---
    Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

    Log-Likelihood: -1951.3
    McFadden R^2:  0.31221
    Likelihood ratio test : chisq = 1771.6 (p.value = < 2.22e-16)

The frequencies of the different alternatives in the sample are first indicated. Next, some information about the optimization are displayed: the Newton-Ralphson method (with analytic gradient and hessian) is used, as it is the most efficient method for this simple model for which the log-likelihood function is concave. Note that very few iterations and computing time are required to estimate this model. Then the usual table of coefficients is displayed followed by some goodness of fit measures: the value of the log-likelihood function, which is compared to the value when only intercepts are introduced, which leads to the computation of the McFadden \(R^2\) and to the likelihood ratio test.

The `fitted` method can be used either to obtain the probability of actual choices (`type = "outcome"`) or the probabilities for all the alternatives (`type = "probabilities"`).

    head(fitted(ml.MC1, type = "outcome"))

          109       110       111       112       113       114
    0.1909475 0.3399941 0.1470527 0.3399941 0.3399941 0.2440011

    head(fitted(ml.MC1, type = "probabilities"), 4)

              car     train       air
    109 0.4206404 0.3884120 0.1909475
    110 0.3696476 0.2903582 0.3399941
    111 0.4296769 0.4232704 0.1470527
    112 0.3696476 0.2903582 0.3399941

Note that the log-likelihood is the sum of the log of the fitted outcome probabilities and that, as the model contains intercepts, the average fitted probabilities for every alternative equals the market shares of the alternatives in the sample.

    sum(log(fitted(ml.MC1, type = "outcome")))
    ## [1] -1951.344
    logLik(ml.MC1)
    ## 'log Lik.' -1951.344 (df=9)
    apply(fitted(ml.MC1, type = "probabilities"), 2, mean)
    ##       car     train       air
    ## 0.4575659 0.1672084 0.3752257

Predictions can be made using the `predict` method. If no data is provided, predictions are made for the sample mean values of the covariates.

    head(predict(ml.MC1, shape = "wide"))
    ##       car     train       air
    ## 0.5066362 0.2116876 0.2816761

Assume, for example, that we wish to predict the effect of a reduction of train transport time of 20%. We first create a new `data.frame` simply by multiplying train transport time by 0.8 and then using the `predict` method with this new `data.frame`.

    NMC <- MC
    NMC$time[NMC$alt == "train"] <- 0.8 * NMC$time[NMC$alt == "train"]
    Oprob <- fitted(ml.MC1, type = "probabilities")
    Nprob <- predict(ml.MC1, newdata = NMC, shape = "wide")
    rbind(old = apply(Oprob, 2, mean), new = apply(Nprob, 2, mean))

              car     train       air
    old 0.4575659 0.1672084 0.3752257
    new 0.4044736 0.2635801 0.3319462

If, for the first individuals in the sample, we compute the ratio of the probabilities of the air and the car mode, we obtain:

    head(Nprob[, "air"] / Nprob[, "car"])
    ##       109       110       111       112       113       114
    ## 0.4539448 0.9197791 0.3422401 0.9197791 0.9197791 0.6021092
    head(Oprob[, "air"] / Oprob[, "car"])
    ##       109       110       111       112       113       114
    ## 0.4539448 0.9197791 0.3422401 0.9197791 0.9197791 0.6021092

which is an illustration of the IIA property. If train time changes, it changes the probabilities of choosing air and car, but not their ratio.

We next compute the surplus for individuals of the sample induced by train time reduction. This requires the computation of the log-sum term (also called inclusive value or inclusive utility) for every choice situation, which is:

\[ \mbox{iv}_i = \ln \sum_{j = 1} ^ J e^{\beta^\top x_{ij}}. \]

For this purpose, we use the `logsum` function, which works on a vector of `coefficients` and a `model.matrix`. The basic use of `logsum` consists on providing as unique argument (called `coef`) a `mlogit` object. In this case, the `model.matrix` and the `coef` are extracted from the same model.

    ivbefore <- logsum(ml.MC1)

To compute the log-sum after train time reduction, we must provide a `model.matrix` which is not the one corresponding to the fitted model. This can be done using the `X` argument which is a matrix or an object from which a `model.matrix` can be extracted. This can also be done by filling the `data` argument (a `data.frame` or an object from which a `data.frame` can be extracted using a `model.frame` method), and eventually the `formula` argument (a `formula` or an object for which the `formula` method can be applied). If no formula is provided but if `data` is a `dfidx` object, the formula is extracted from it.

    ivafter <- logsum(ml.MC1, data = NMC)

Surplus variation is then computed as the difference of the log-sums divided by the opposite of the cost coefficient which can be interpreted as the marginal utility of income:

    surplus <- - (ivafter - ivbefore) / coef(ml.MC1)["cost"]
    summary(surplus)
    ##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
    ##  0.5852  2.8439  3.8998  4.6971  5.8437 31.3912

Consumer’s surplus variation range from 0.6 to 31 Canadian $, with a median value of about 4$. Marginal effects are computed using the `effects` method. By default, they are computed at the sample mean, but a `data` argument can be provided. The variation of the probability and of the covariate can be either absolute or relative. This is indicated with the `type` argument which is a combination of two `a` (as absolute) and `r` (as relative) characters. For example, `type = "ar"` means that what is measured is an absolute variation of the probability for a relative variation of the covariate.

    effects(ml.MC1, covariate = "income", type = "ar")
    ##        car      train        air
    ## -0.1822177 -0.1509079  0.3331256

The results indicate that, for a 100% increase of income, the probability of choosing `air` increases by 33 points of percentage, as the probabilities of choosing `car` and `train` decrease by 18 and 15 points of percentage. For an alternative specific covariate, a matrix of marginal effects is displayed.

    effects(ml.MC1, covariate = "cost", type = "rr")
    ##              car      train        air
    ## car   -0.9131273  0.9376923  0.9376923
    ## train  0.3358005 -1.2505014  0.3358005
    ## air    1.2316679  1.2316679 -3.1409703

The cell in the \(l^{\mbox{th}}\) row and the \(c^{\mbox{th}}\) column indicates the change of the probability of choosing alternative \(c\) when the cost of alternative \(l\) changes. As `type = "rr"`, elasticities are computed. For example, a 10% change of train cost increases the probabilities of choosing car and air by 3.36%. Note that the relative changes of the probabilities of choosing one of these two modes are equal, which is a consequence of the IIA property.

Finally, in order to compute travel time valuation, we divide the coefficients of travel times (in minutes) by the coefficient of monetary cost (in $).

    coef(ml.MC1)[grep("time", names(coef(ml.MC1)))] /
        coef(ml.MC1)["cost"] * 60
    ##   time:car time:train   time:air
    ##   29.52728   23.09447   36.95360

The value of travel time ranges from 23 for train to 37 Canadian $ per hour for plane.

### NOx

The second example is a data set used by Fowlie (2010), called `NOx`. She analyzed the effect of an emissions trading program (the NOx budget program which seeks to reduce the emission of nitrogen oxides) on the behavior of producers. More precisely, coal electricity plant managers may adopt one out of fifteen different technologies in order to comply to the emissions defined by the program. Some of them require high investment (the capital cost is `kcost`) and are very efficient to reduce emissions, some other require much less investment but are less efficient and the operating cost (denoted `vcost`) is then higher, especially because pollution permits must be purchased to offset emissions exceeding their allocation.

The focus of the paper is on the effects of the regulatory environment on manager’s behavior. Some firms are deregulated, whereas other are either regulated or public. Rate of returns is applied for regulated firms, which means that they perceive a “fair” rate of return on their investment. Public firms also enjoy significant cost of capital advantages. Therefore, the main hypothesis of the paper is that public and regulated firms will adopt much more capitalistic intensive technologies than deregulated and public ones, which means that the coefficient of capital cost should take a higher negative value for deregulated firms. Capital cost is interacted with the age of the plant (measured as a deviation from the sample mean age), as firms should weight capital costs more heavily for older plants, as they have less time to recover these costs.

Multinomial logit models are estimated for the three subsamples defined by the regulatory environment. The 15 technologies are not available for every plants, the sample is therefore restricted to available technologies, using the `available` covariate. Three technology dummies are introduced: `post` for post-combustion polution control technology, `cm` for combustion modification technology and `lnb` for low NOx burners technology.

A last model is estimated for the whole sample, but the parameters are allowed to be proportional to each other. The scedasticity function is described in the fourth part of the formula, it contains here only one covariate, `env`. Note also that for the last model, the author introduced a specific capital cost coefficient for deregulated firms.1

    NOx$kdereg <- with(NOx, kcost * (env == "deregulated"))
    NOxml <- dfidx(NOx, idx = c(id = "chid", "alt"))
    ml.pub <- mlogit(choice ~ post + cm + lnb + vcost +
                         kcost + kcost:age | - 1,
                     subset = available & env == "public",
                     data = NOxml)
    ml.reg <- update(ml.pub, subset = available & env == "regulated")
    ml.dereg <- update(ml.pub, subset = available & env == "deregulated")
    ml.pool <- ml.dereg
    ml.pool <- mlogit(choice ~ post + cm + lnb + vcost + kcost +
                          kcost:age + kdereg | - 1 | 0 | env,
                      subset = available == 1, data = NOxml,
                      method = "bhhh")

Results are presented below:

                        Public Deregulated Reguated  Pooled
    post               -5.7058     -1.5020 -2.66549 -2.3100
    cm                 -4.4325     -1.5379 -1.91096 -2.0621
    lnb                -3.9637     -1.5511 -2.20769 -2.0329
    vcost              -1.5641     -0.1878 -0.27844 -0.3120
    kcost               0.0388     -0.0601  0.00751  0.0085
    kcost:age          -0.0804     -0.0372 -0.02327 -0.0201
    kdereg                   -           -        - -0.0666
    sig.envderegulated       -           -        -  0.3188
    sig.envpublic            -           -        - -0.3262

modelsummary::msummary(list(Public = ml.pub, Deregulated = ml.dereg, Reguated = ml.reg, Pooled = ml.pool), output = “.txt”) writeLines(readLines(”.txt”))

    <!-- Results are presented in @tbl-models. -->
    Coefficients are very different
    on the sub-samples defined by the regulatory environment. Note in
    particular that the capital cost coefficient is positive and
    insignificant for public and regulated firms, as it is significantly
    negative for deregulated firms. Errors seems to have significant
    larger variance for deregulated firms and lower ones for public firms
    compared to regulated firms. The hypothesis that the coefficients
    (except the `kcost` one) are identical up to a multiplicative scalar
    can be performed using a likelihood ratio test:

    ::: {.cell}

    ```{.r .cell-code}
    stat <- 2 * (logLik(ml.dereg) + logLik(ml.reg) +
                 logLik(ml.pub) - logLik(ml.pool))
    stat
    ## 'log Lik.' 61.6718 (df=6)
    pchisq(stat, df = 9, lower.tail = FALSE)
    ## 'log Lik.' 6.377283e-10 (df=6)

:::

The hypothesis is strongly rejected.

### Predictions and marginal effects

Since version `2.0-0`, mlogit provides a `preds` and a `slps` function to, respectively, compute the predictions and the slopes for every observations, along with their standard deviations. Since the computation is time-consuming, we first fit again a transport choice model, but on a small subset of the `ModeCanada` data set:

    ids <- unique(ModeCanada$case)
    set.seed(1L)
    ids <- sample(ids, 50)
    smallMC <- subset(ModeCanada, case %in% ids)
    ml <- mlogit(choice ~ cost | income, smallMC, alt.subset = c("car", "train", "air"))

We then compute the predictions and the slopes:

    .p <- preds(ml)
    .s <- slps(ml)
    .p

    ~~~~~~~
     first 10 observations out of 147
    ~~~~~~~
         estimate  std.error      idx
    1  0.08846487 0.04126765  22:rain
    2  0.33414906 0.10639315   22:air
    3  0.57738607 0.11490367   22:car
    4  0.26989633 0.23038306  37:rain
    5  0.00000000 0.00000000   37:air
    6  0.73010367 0.23038306   37:car
    7  0.18843056 0.07255561  84:rain
    8  0.16410972 0.07652485   84:air
    9  0.64745971 0.10762116   84:car
    10 0.01399801 0.01363133 270:rain

    ~~~ indexes ~~~~
       case   alt
    1    22 train
    2    22   air
    3    22   car
    4    37 train
    5    37   air
    6    37   car
    7    84 train
    8    84   air
    9    84   car
    10  270 train
    indexes:  1, 2

    head(.s)

        term id   alt      estimate   std.error  statistic   p.value
    1 income 22 train -0.0035400325 0.002833851 -1.2491951 0.2115937
    2 income 22   air  0.0043811405 0.005010496  0.8743927 0.3819044
    3 income 22   car -0.0008411085 0.005749648 -0.1462887 0.8836935
    4 income 37 train -0.0075982384 0.009744800 -0.7797224 0.4355543
    5 income 37   air  0.0000000000 0.000000000        NaN       NaN
    6 income 37   car  0.0075982386 0.009474467  0.8019700 0.4225703

Both functions return a data frame with an `"estimate"` and a `"std.error"` columns. The object returned by `predicts` is a `dfidx` object and has the same number of rows than the model frame of the fitted model. The object returned by `slps` is not a `dfidx` because it contains, for each combinations of the two indexes, not one line but a number of line equal to the number of effects (3 in the example). Both functions have a summary method which computes, for the `slps` function, the average marginal effects:

    summary(.p)

        alt  estimate  std.error
    1 train 0.1428581 0.04969050
    2   air 0.4081627 0.06014833
    3   car 0.4489792 0.05969223

    summary(.s)

             term   alt      estimate    std.error   statistic
    1    cost_air   air -0.0139029057 0.0012531231 -11.0946050
    2    cost_air   car  0.0097277379 0.0010254419   9.4863859
    3    cost_air train  0.0041751678 0.0008377610   4.9837220
    4    cost_car   air  0.0097277379 0.0010376296   9.3749620
    5    cost_car   car -0.0139836651 0.0013168225 -10.6192482
    6    cost_car train  0.0042559272 0.0008545143   4.9805222
    7  cost_train   air  0.0041751677 0.0008384765   4.9794692
    8  cost_train   car  0.0042559271 0.0008499162   5.0074666
    9  cost_train train -0.0084310948 0.0013103377  -6.4342918
    10     income   air  0.0043856371 0.0013500802   3.2484272
    11     income   car  0.0002701354 0.0013389223   0.2017558
    12     income train -0.0046557725 0.0011737373  -3.9666222
            p.value
    1  1.332473e-28
    2  2.391832e-21
    3  6.237268e-07
    4  6.920070e-21
    5  2.425064e-26
    6  6.341293e-07
    7  6.375890e-07
    8  5.515111e-07
    9  1.240504e-10
    10 1.160449e-03
    11 8.401076e-01
    12 7.289842e-05

## Bibliography

Fowlie, Meredith. 2010. “Emissions Trading, Electricity Restructuring, and Investment in Pollution Abatement.” American Economic Review 100 (3): 837–69. https://doi.org/10.1257/aer.100.3.837.
McFadden, D. 1974. “The Measurement of Urban Travel Demand.” Journal of Public Economics 3: 303–28.
Small, K. A., and H. S. Rosen. 1981. “Applied Welfare Economics with Discrete Choice Models.” Econometrica 49: 105–30.
Toomet, Ott, and Arne Henningsen. 2010. maxLik: Maximum Likelihood Estimation. https://CRAN.R-project.org/package=maxLik.

1. Note the use of the `method` argument, set to `bhhh`. `mlogit` use its own optimisation functions, but borrows its syntax from package `maxLik` (Toomet and Henningsen 2010). The default method is `bfgs`, except for the basic model, for which it is `nr`. As the default algorithm failed to converg, we use here `bhhh`.↩︎