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

FLXMRcondlogit

FlexMix Interface to Conditional Logit Models


Description

Model driver for fitting mixtures of conditional logit models.

Usage

FLXMRcondlogit(formula = . ~ ., strata)

Arguments

formula

A formula which is interpreted relative to the formula specified in the call to flexmix using update.formula. Default is to use the original flexmix model formula.

strata

A formula which is interpreted such that no intercept is fitted and which allows to determine the variable indicating which observations are from the same stratum.

Details

The M-step is performed using coxph.fit.

Value

Returns an object of class FLXMRcondlogit.

Warning

To ensure identifiability repeated measurements are necessary. Sufficient conditions are given in Gruen and Leisch (2008).

Author(s)

Bettina Gruen

References

Bettina Gruen and Friedrich Leisch. Identifiability of finite mixtures of multinomial logit models with varying and fixed effects. Journal of Classification, 25, 225–247. 2008.

See Also

Examples

if (require("Ecdat")) {
  data("Catsup", package = "Ecdat")
  ## To reduce the time needed for the example only a subset is used
  Catsup <- subset(Catsup, id %in% 1:100)
  Catsup$experiment <- seq_len(nrow(Catsup))
  vnames <- c("display", "feature", "price")
  Catsup_long <-
    reshape(Catsup,
            idvar = c("id", "experiment"),
            times = c(paste("heinz", c(41, 32, 28), sep = ""),
              "hunts32"),
            timevar = "brand",
            varying = matrix(colnames(Catsup)[2:13], nrow = 3, byrow = TRUE),
            v.names = vnames,
            direction = "long")
  Catsup_long$selected <- with(Catsup_long, choice == brand)
  Catsup_long <- Catsup_long[, c("id", "selected", "experiment", vnames, "brand")]
  Catsup_long$brand <- relevel(factor(Catsup_long$brand), "hunts32")
  set.seed(0808)
  flx1 <- flexmix(selected ~ display + feature + price + brand | id,
                  model = FLXMRcondlogit(strata = ~ experiment), 
                  data = Catsup_long, k = 1)
}

flexmix

Flexible Mixture Modeling

v2.3-17
GPL (>= 2)
Authors
Bettina Gruen [aut, cre] (<https://orcid.org/0000-0001-7265-4773>), Friedrich Leisch [aut] (<https://orcid.org/0000-0001-7278-1983>), Deepayan Sarkar [ctb] (<https://orcid.org/0000-0003-4107-1553>), Frederic Mortier [ctb], Nicolas Picard [ctb] (<https://orcid.org/0000-0001-5548-9171>)
Initial release

We don't support your browser anymore

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