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

Description Usage Arguments Author(s) References See Also Examples

View source: R/Rchoice.methods.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
## Probit Model with Random Effects and Random Parameters
data('Unions', package = 'pglm')
Unions$lwage <- log(Unions$wage)
union.ran <- Rchoice(union ~ age + exper + rural + lwage,
                     data = Unions[1:2000, ],
                     family = binomial('probit'),
                     ranp = c(constant = "n", lwage = "t"),
                     R = 10,
                     panel = TRUE,
                     index = "id",
                     print.init = TRUE)

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

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

## Plot the compensating variation
plot(union.ran, par = "lwage", effect = "cv", wrt = "rural", type = "histogram")

## End(Not run)

Rchoice documentation built on July 1, 2020, 7:38 p.m.