plot.gmnl {gmnl}R Documentation

Plot of the Distribution of the Conditional Expectation of Random Parameters

Description

Methods for gmnl objects which provide a plot of the distribution of the conditional expectation of the random parameters or the distribution of the conditional willigness-to-pay.

Usage

## S3 method for class 'gmnl'
plot(
  x,
  par = NULL,
  effect = c("ce", "wtp"),
  wrt = NULL,
  type = c("density", "histogram"),
  adjust = 1,
  main = NULL,
  col = "indianred1",
  breaks = 10,
  ylab = NULL,
  xlab = NULL,
  ind = FALSE,
  id = NULL,
  ...
)

Arguments

x

an object of class gmnl.

par

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

effect

a string indicating whether the conditional expectation, "ce", or the WTP, "wtp" should be plotted.

wrt

a string indicating with respect to which variable the WTP should be computed if effect = "wtp".

type

a string indicating the type of distribution: it can be a histogram or a density of the conditional expectation of the random coefficients or WTP.

adjust

bandwidth for the kernel density.

main

an overall title for the plot.

col

color for the graph.

breaks

number of breaks for the histrogram if type = "histogram".

ylab

a title for the y axis.

xlab

a title for the x axis.

ind

a boolean. If TRUE, a 95% interval of conditional distribution for each individual is plotted. As default, the conditional expectation of par for the first 10 individual is plotted.

id

only relevant if ind is not NULL. This is a vector indicating the individuals for whom the user want to plot the conditional coefficients.

...

further arguments to be passed to plot or plotCI.

Author(s)

Mauricio Sarrias

References

See Also

gmnl for the estimation of different multinomial models with individual heterogeneity and effect.gmnl.

Examples

## Not run: 
## Examples using the Electricity data set from the mlogit package
library(mlogit)
data("Electricity", package = "mlogit")
Electr <- mlogit.data(Electricity, id.var = "id", choice = "choice",
                     varying = 3:26, shape = "wide", sep = "")
                     
## Estimate a MIXL model with correlated random parameters
Elec.cor <- gmnl(choice ~ pf + cl + loc + wk + tod + seas| 0, data = Electr,
                 subset = 1:3000,
                 model = 'mixl',
                 R = 10,
                 panel = TRUE,
                 ranp = c(cl = "n", loc = "n", wk = "n", tod = "n", seas = "n"),
                 correlation = TRUE)
                 
## Plot the density of the conditional expectation distribution of loc
plot(Elec.cor, par = "loc", effect = "ce", type = "density", col = "grey")

## Plot the conditional expectation of loc for each individual
plot(Elec.cor, par = "loc", effect = "ce", ind = TRUE, id = 1:30)

## Plot the WTP for cl
plot(Elec.cor, par = "loc", effect = "wtp", wrt = "pf")                  

## End(Not run) 

[Package gmnl version 1.1-3.2 Index]