RprobitB_normalization: Create object of class 'RprobitB_normalization'

View source: R/model_fitting.R

RprobitB_normalizationR Documentation

Create object of class RprobitB_normalization

Description

This function creates an object of class RprobitB_normalization, which determines the utility scale and level.

Usage

RprobitB_normalization(
  level,
  scale = "Sigma_1,1 := 1",
  form,
  re = NULL,
  alternatives,
  base,
  ordered = FALSE
)

## S3 method for class 'RprobitB_normalization'
print(x, ...)

Arguments

level

The alternative name with respect to which utility differences are computed. Currently, only differences with respect to the last alternative can be computed.

scale

A character which determines the utility scale. It is of the form ⁠<parameter> := <value>⁠, where ⁠<parameter>⁠ is either the name of a fixed effect or ⁠Sigma_<j>,<j>⁠ for the ⁠<j>⁠th diagonal element of Sigma, and ⁠<value>⁠ is the value of the fixed parameter.

form

A formula object that is used to specify the model equation. The structure is choice ~ A | B | C, where

  • choice is the name of the dependent variable (the choices),

  • A are names of alternative and choice situation specific covariates with a coefficient that is constant across alternatives,

  • B are names of choice situation specific covariates with alternative specific coefficients,

  • and C are names of alternative and choice situation specific covariates with alternative specific coefficients.

Multiple covariates (of one type) are separated by a + sign. By default, alternative specific constants (ASCs) are added to the model. They can be removed by adding +0 in the second spot.

In the ordered probit model (ordered = TRUE), the formula object has the simple structure choice ~ A. ASCs are not estimated.

re

A character (vector) of covariates of form with random effects. If re = NULL (the default), there are no random effects. To have random effects for the ASCs, include "ASC" in re.

alternatives

A character vector with the names of the choice alternatives. If not specified, the choice set is defined by the observed choices. If ordered = TRUE, alternatives is assumed to be specified with the alternatives ordered from worst to best.

base

A character, the name of the base alternative for covariates that are not alternative specific (i.e. type 2 covariates and ASCs). Ignored and set to NULL if the model has no alternative specific covariates (e.g. in the ordered probit model). Per default, base is the last element of alternatives.

ordered

A boolean, FALSE per default. If TRUE, the choice set alternatives is assumed to be ordered from worst to best.

x

An object of class RprobitB_normalization.

...

Currently not used.

Details

Any choice model has to be normalized with respect to the utility level and scale.

  • For level normalization, {RprobitB} takes utility differences with respect to one alternative. For the ordered model where only one utility is modeled, {RprobitB} fixes the first utility threshold to 0.

  • For scale normalization, {RprobitB} fixes one model parameter. Per default, the first error-term variance is fixed to 1. This is specified via scale = "Sigma_1,1 := 1". Alternatively, any error-term variance or any non-random coefficient can be fixed.

Value

An object of class RprobitB_normalization, which is a list of

  • level, a list with the elements level (the number of the alternative specified by the input level) and name (the name of the alternative, i.e. the input level), or alternatively NA in the ordered probit case,

  • and scale, a list with the elements parameter (either "s" for an element of Sigma or "a"for an element of alpha), the parameter index, and the fixed value. If parameter = "a", also the name of the fixed effect.

Examples

RprobitB:::RprobitB_normalization(
  level = "B",
  scale = "price := -1",
  form = choice ~ price + time + comfort + change | 1,
  re = "time",
  alternatives = c("A", "B"),
  base = "A"
)


loelschlaeger/RprobitB documentation built on Oct. 15, 2024, 11:08 a.m.