Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

simulateShares

Simulate expected shares from a set of alternatives


Description

Returns the expected shares of a specific set of alternatives based on an estimated model.

Usage

simulateShares(model, alts, priceName = NULL, alpha = 0.025)

Arguments

model

The output of a model estimated model using the logitr() function.

alts

A data frame of a set of alternatives for which to simulate shares. Each row is an alternative and each column an attribute corresponding to parameter names in the estimated model.

priceName

The name of the parameter that identifies price. Only required for WTP space models. Defaults to NULL.

alpha

The sensitivity of the computed confidence interval, e.g. a 90% CI is obtained with alpha = 0.05. Defaults to alpha = 0.025.

Value

A data frame with the estimated shares for each alternative in alts.

Examples

# Run a MNL model in the Preference Space:
library(logitr)

mnl_pref <- logitr(
  data = yogurt,
  choiceName = "choice",
  obsIDName = "obsID",
  parNames = c("price", "feat", "dannon", "hiland", "yoplait")
)

# Create a set of alternatives for which to simulate shares:
alts <- subset(yogurt, obsID == 42,
  select = c("feat", "price", "dannon", "hiland", "yoplait")
)
row.names(alts) <- c("dannon", "hiland", "weight", "yoplait")
alts

# Run the simulation using the estimated preference space MNL model:
simulateShares(mnl_pref, alts)

logitr

Logit Models w/Preference & WTP Space Utility Parameterizations

v0.1.0
MIT + file LICENSE
Authors
John Helveston [aut, cre, cph] (<https://orcid.org/0000-0002-2657-9191>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.