fitted.logitr: Extract Model Fitted Values

View source: R/methods.R

fitted.logitrR Documentation

Extract Model Fitted Values

Description

Returns fitted values from an object of class logitr.

Usage

## S3 method for class 'logitr'
fitted(object, probs = NULL, ...)

Arguments

object

is an object of class logitr (a model estimated using the 'logitr()' function).

probs

Predicted probabilities for an object of class logitr to use in computing fitted values Defaults to NULL.

...

further arguments.

Value

A data frame of the obsID and the fitted values extracted from object.

Examples

library(logitr)

# Estimate a preference space model
mnl_pref <- logitr(
  data    = yogurt,
  outcome = "choice",
  obsID   = "obsID",
  pars    = c("price", "feat", "brand")
)

# Extract the fitted values from the model
fitted(mnl_pref)

logitr documentation built on Sept. 11, 2024, 6:40 p.m.