Learn R Programming

gmnl (version 1.1-3.2)

effect.gmnl: Get the Conditional Individual Coefficients

Description

This a helper function to obtain the individuals' conditional estimate of the either random parameters or willingness-to-pay.

Usage

effect.gmnl(x, par = NULL, effect = c("ce", "wtp"), wrt = NULL, ...)

Arguments

x

an object of class gmnl.

par

a string giving the name of the variable with a random parameter.

effect

a string indicating what should be computed: the conditional expectation of the individual coefficients "ce", or the conditional expectation of the willingness-to-pay "wtp".

wrt

a string indicating with respect to which variable the willingness-to-pay should be computed.

...

further arguments. Ignorred.

Value

A named list where "mean" contains the individuals' conditional mean for the random parameter or willingness-to-pay, and where "sd.est" contains standard errors.

References

  • Greene, W. H. (2012). Econometric Analysis, Seventh Edition. Pearson Hall.

  • Train, K. (2009). Discrete Choice Methods with Simulation. Cambridge University Press.

See Also

gmnl for the estimation of multinomial Logit models with individual parameters.

Examples

Run this code
# NOT RUN {
## Data
data("TravelMode", package = "AER")
library(mlogit)
TM <- mlogit.data(TravelMode, choice = "choice", shape = "long", 
                 alt.levels = c("air", "train", "bus", "car"), chid.var = "individual")
                 
## MIXL model with observed heterogeneity
mixl.hier <- gmnl(choice ~ vcost + gcost + travel + wait | 1 | 0 | income + size - 1,
                 data = TM,
                 model = "mixl",
                 ranp = c(travel = "t", wait = "n"),
                 mvar = list(travel = c("income","size"), wait = c("income")),
                 R = 30,
                 haltons = list("primes"= c(2, 17), "drop" = rep(19, 2)))
                 
## Get the individuals' conditional mean and their standard errors for lwage
bi.travel <- effect.gmnl(mixl.hier, par = "travel", effect = "ce")
summary(bi.travel$mean)
summary(bi.travel$sd.est)

## Get the individuals' conditional WTP of travel with respect to gcost
wtp.travel <- effect.gmnl(mixl.hier, par = "travel", effect = "wtp", wrt = "gcost")
summary(wtp.travel$mean)
summary(wtp.travel$sd.est)
# }

Run the code above in your browser using DataLab