Free Access Week - Data Engineering + BI
Data engineering and BI courses are free!
Free Access Week - Jun 2-8

nestedLogit (version 0.3.2)

models: Extract Binary Logit Models from a nestedLogit Object

Description

models is used to extract "glm" objects representing binary logit models from a "nestedLogit" object.

Usage

models(model, select, as.list = FALSE)

# S3 method for nestedLogit models(model, select, as.list = FALSE)

Value

model returns either a single "glm" object (see glm) or a list of "glm" objects, each representing a binary logit model.

Arguments

model

a "nestedLogit" model.

select

a numeric or character vector giving the number(s) or names(s) of one or more binary logit models to be extracted from model; if absent, a list of all of the binary logits models in model is returned.

as.list

if TRUE (the default is FALSE) and one binary logit model is selected, return the "glm" object in a one-element named list; otherwise a single model is returned directly as a "glm" object; when more than one binary logit model is selected, the corresponding "glm" objects are always returned as a named list.

Examples

Run this code
  data("Womenlf", package = "carData")
  comparisons <- logits(work=dichotomy("not.work",
                                       working=c("parttime", "fulltime")),
                        full=dichotomy("parttime", "fulltime"))
  m <- nestedLogit(partic ~ hincome + children,
                   dichotomies = comparisons,
                   data=Womenlf)

  # extract a binomial logit model
  models(m, "work")
  # use that to plot residuals
  plot(density(residuals(models(m, "work"))))

Run the code above in your browser using DataLab