plot.Rchoice: Plot the distribution of conditional expectation for random...

View source: R/Rchoice.methods.R

plot.RchoiceR Documentation

Plot the distribution of conditional expectation for random parameters.

Description

Plot the distribution of the conditional expectation of the random parameters or compensating variations for objects of class Rchoice.

Usage

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

Arguments

x

a object of class Rchoice,

par

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

effect

a string indicating what should be plotted: the conditional expectation of the individual coefficients "ce", or the conditional expectation of the individual compensating variations "cv",

wrt

a string indicating repect to which variable should be computed the compensating variation,

type

a string indicating the type of distribution: it can be a histogram or a density of the conditional expectation,

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 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 which the confidence intervals are plotted,

...

further arguments. Ignored.

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

Rchoice for the estimation of different discrete choice models with individual parameters.

Examples


# Poisson with random parameters
data("Articles")
poisson.ran <- Rchoice(art ~ fem + mar + kid5 + phd + ment, 
                       data = Articles,  family = poisson,
                       ranp = c(kid5 = "n", phd = "n", ment = "n"), 
                       R = 10)

## Plot the distribution of the conditional mean for ment
plot(poisson.ran, par = "ment", type = "density")

## Plot the conditional mean for the first 20 individuals
plot(poisson.ran, par = "ment", ind =  TRUE, id = 1:20, col = "blue")

## Plot the compensating variation with respect to fem
plot(poisson.ran, par = "ment", effect = "cv", wrt = "fem", type = "histogram")


Rchoice documentation built on March 31, 2023, 11:13 p.m.