Skip to contents

For each decision maker, the mean and standard deviation of the random coefficients conditional on the choices they were observed to make, \(E[\beta_n \mid y_n, x_n; \hat\theta]\) (Revelt and Train 2000; Train 2009, ch. 11): the frequentist counterpart of the individual-level beta_i summaries of run_hmnlogit.

Usage

conditional_tastes(object, ...)

# Default S3 method
conditional_tastes(object, ...)

# S3 method for class 'choicer_mxl'
conditional_tastes(object, ...)

Arguments

object

A choicer_mxl fit with stored data (keep_data = TRUE).

...

Unused.

Value

An object of class choicer_tastes: a list with

mean, sd

\(K_w \times U\) matrices of conditional means and standard deviations; rows are the random coefficients (random_var_cols), columns the \(U\) likelihood units, named by decision-maker id (person_col) or by choice-situation id.

unit

"decision maker" or "choice situation".

n_units

\(U\).

S

Simulation draws per unit.

weights

Unit weights used in population.

population

A data.frame with one row per random coefficient: model_mean and model_sd, the moments of \(f(\beta \mid \hat\theta)\); mean_cond and sd_cond, the weighted mean and standard deviation of the conditional means across units; revealed \(= Var(E[\beta \mid y]) / Var(\beta)\); and residual \(= E[Var(\beta \mid y)] / Var(\beta)\).

Details

Estimand. The fit estimates the population distribution of tastes, \(f(\beta \mid \theta)\). Among decision makers who face \(x_n\) and make the choices \(y_n\), tastes follow the conditional distribution $$h(\beta \mid y_n, x_n; \theta) = \frac{P(y_n \mid x_n, \beta) \, f(\beta \mid \theta)} {\int P(y_n \mid x_n, \beta) \, f(\beta \mid \theta) \, d\beta},$$ where \(P(y_n \mid x_n, \beta) = \prod_t P_{nt}(j_{nt} \mid \beta)\) is the product of the decision maker's logit probabilities. Its mean and standard deviation are simulated at \(\hat\theta\) with the estimation draws, as weighted averages over draws \(\beta_{ns}\) with weights \(\omega_{ns} \propto P(y_n \mid x_n, \beta_{ns})\). Coefficients are on the scale they enter utility: \(\mu_k + (L\eta)_k\) for a normal coefficient and \(\exp(\mu_k) + \exp((L\eta)_k)\) for the shifted log-normal, with the \(\mu\) term present only when rc_mean = TRUE. If a variable's mean is carried instead by the same variable in covariate_cols (with rc_mean = FALSE), only its random part is reported. This is the utility scale; the beta_i summaries of run_hmnlogit() are on the scale of the underlying normal, i.e. the log of the coefficient for log-normal coordinates.

What it is not. The conditional mean is not the decision maker's own \(\beta_n\). It is the average taste among people who would make \(n\)'s choices, so it shrinks toward the population mean, the more so the fewer choice situations \(n\) contributes, and its dispersion across decision makers understates the population dispersion. By the law of iterated expectations the conditional means average, in large samples, to the population mean (mean_cond vs model_mean in population), and by the law of total variance \(Var(\beta) = Var(E[\beta \mid y]) + E[Var(\beta \mid y)]\): the share of taste variance revealed by choices (revealed) and the share left unresolved (residual) should sum to about one. These are numerical checks, not specification tests: for normal random coefficients with free means, both identities are the likelihood's first-order conditions for \(\mu\) and \(\Sigma\), so they hold at a converged maximum whatever the true taste distribution. A departure points to too few draws S or an unconverged \(\hat\theta\); when a random coefficient's mean is fixed at zero (rc_mean = FALSE and no fixed coefficient on the same variable), a mean_cond far from zero can also flag that restriction. For log-normal coefficients the variance identity holds on the underlying normal scale, not the utility scale reported here, so expect departures of a few percent in either direction at moderate S. The sd is the dispersion of the conditional distribution of tastes, not a standard error: it ignores the sampling error in \(\hat\theta\).

Cross-section. Without person_col each choice situation is its own decision maker. A single choice reveals little about tastes, so the conditional means stay close to the population mean (revealed small); fit with person_col to learn about tastes from repeated choices.

Choice probabilities are handled in log space, so every unit has a finite conditional distribution however improbable its choices. Only a unit whose utilities overflow at the estimates (non-finite log-likelihood) gets NA, and it is left out of the population summaries.

References

Revelt, D. and Train, K. (2000). Customer-specific taste parameters and mixed logit: households' choice of electricity supplier. Working Paper E00-274, Department of Economics, University of California, Berkeley.

Train, K. (2009). Discrete Choice Methods with Simulation, 2nd ed., Ch. 11. Cambridge University Press.

See also

run_mxlogit (person_col), simulate_mxl_data (true_params$gamma_i)

Examples

# \donttest{
sim <- simulate_mxl_data(N = 150, T = 5, J = 3, seed = 1)
fit <- run_mxlogit(sim$data, "id", "alt", "choice", c("x1", "x2"),
                   c("w1", "w2"), outside_opt_label = 0L,
                   rc_correlation = TRUE, person_col = "pid", S = 50L)
#> Optimization run time 0h:0m:0.02s
ct <- conditional_tastes(fit)
ct
#> Conditional tastes E[beta | observed choices] for 150 decision makers (S = 50 draws each)
#> Unit-level means and SDs in $mean and $sd.
#> Population distribution vs conditional means (revealed + residual should be close to 1):
#>    model_mean model_sd mean_cond sd_cond revealed residual
#> w1          0    0.924    -0.003   0.553    0.357    0.647
#> w2          0    0.984     0.049   0.602    0.374    0.616
# conditional means track the realized tastes, with shrinkage
cor(ct$mean["w1", ], sim$true_params$gamma_i["w1", colnames(ct$mean)])
#> [1] 0.646566
# }