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 |
par |
a string giving the name of the variable with random parameter. |
effect |
a string indicating whether the conditional expectation, " |
wrt |
a string indicating with respect to which variable the WTP should be computed if |
type |
a string indicating the type of distribution: it can be a |
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 |
ylab |
a title for the y axis. |
xlab |
a title for the x axis. |
ind |
a boolean. If |
id |
only relevant if |
... |
further arguments to be passed to |
Author(s)
Mauricio Sarrias
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 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)