Description Usage Arguments Details Value Author(s) References See Also Examples
Estimation of discrete choice models such as Binary (logit and probit), Poisson and Ordered (logit and probit) model with random coefficients for crosssectional and panel data using simulated maximum likelihood.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67  Rchoice(
formula,
data,
subset,
weights,
na.action,
family,
start = NULL,
ranp = NULL,
R = 40,
haltons = NA,
seed = 10,
correlation = FALSE,
panel = FALSE,
index = NULL,
mvar = NULL,
print.init = FALSE,
init.ran = 0.1,
gradient = TRUE,
...
)
## S3 method for class 'Rchoice'
terms(x, ...)
## S3 method for class 'Rchoice'
model.matrix(object, ...)
## S3 method for class 'Rchoice'
coef(object, ...)
## S3 method for class 'Rchoice'
nObs(x, ...)
## S3 method for class 'Rchoice'
fitted(object, ...)
## S3 method for class 'Rchoice'
residuals(object, ...)
## S3 method for class 'Rchoice'
df.residual(object, ...)
## S3 method for class 'Rchoice'
update(object, new, ...)
## S3 method for class 'Rchoice'
logLik(object, ...)
## S3 method for class 'Rchoice'
print(
x,
digits = max(3, getOption("digits")  3),
width = getOption("width"),
...
)
## S3 method for class 'Rchoice'
summary(object, ...)
## S3 method for class 'summary.Rchoice'
print(
x,
digits = max(3, getOption("digits")  3),
width = getOption("width"),
...
)

formula 
a symbolic description of the model to be estimated. The 
data 
the data. It may be a 
subset 
an optional vector specifying a subset of observations, 
weights 
an optional vector of weigths, 
na.action 
a function wich indicated what should happen when the data
contains 
family 
the distribution to be used. It might be 
start 
a vector of starting values, 
ranp 
a named vector whose names are the random parameters and values the distribution:
" 
R 
the number of draws if 
haltons 
only relevant if 
seed 
the seed for the pseudorandom draws. This is only relevant if 
correlation 
only relevant if 
panel 
if 
index 
a string indicating the ‘id’ for individuals in the data. This argument is not required if data is a 
mvar 
only valid if 
print.init 
if 
init.ran 
initial values for standard deviation of random parameters. Default is 0.1, 
gradient 
if 
... 
further arguments passed to 
x, object 
and object of class 
new 
an updated formula for the update method, 
digits 
number of digits, 
width 
width, 
The models are estimated using the maxLik
function from maxLik
package.
If ranp
is not NULL
, the random parameter model is estimated.
A random parameter model or random coefficient models permits regression parameter to
vary across individuals according to some distribution. A fully parametric
random parameter model specifies the latent variable y^{*} conditional on regressors
x and given parameters β_i to have conditional density f(yx, β_i) where
β_i are iid with density g(β_iθ_i). The density is assumed a priori by the user by the argument
ranp
. If the parameters are assumed to be normally distributed β_i ~ N(β, Σ), then the random parameter are constructed as:
β_{ir}=β+Lω_{ir}
where LL'=Σ and ω_{ir} is the rth draw from standard normal distribution for individual i.
Once the model is specified by the argument family
, the model is estimated using
Simulated Maximum Likelihood (SML). The probabilities, given by f(yx, β_i), are simulated using R
pseudodraws if halton=NULL
or R
halton draws if halton = NA
. The user can also specified the primes and the number of dropped elements for the halton draws. For example, if the model consists of two random parameters, the user can specify haltons = list("prime" = c(2, 3), "drop" = c(11, 11))
.
A random parameter hierarchical model can be estimated by including heterogeneity in the mean of the random parameters:
β_{ir}=β+π's_i+Lω_{ir}
Rchoice manages the variables in the hierarchical model by the formula
object: all the hierarchical variables (s_i) are included after the 
symbol. The argument mvar
indicate which variables enter in each random parameter. See examples below
An object of class “Rchoice
”, a list elements:
coefficients 
the named vector of coefficients, 
family 
type of model, 
link 
distribution of the errors, 
logLik 
a set of values of the maximum likelihood procedure, 
mf 
the model framed used, 
formula 
the formula (a Formula object), 
time 

freq 
frequency of dependent variable, 
draws 
type of draws used, 
R.model 

R 
number of draws used, 
bi 
an array of dimension N \times R \times K with the individual parameters, 
Qir 
matrix of dimension N \times R representing P_{ir}/∑_r P_{ir}, 
ranp 
vector indicating the variables with random parameters and their distribution, 
probabilities 
the fitted probabilities for each individuals, 
residuals 
the residuals, 
call 
the matched call. 
Mauricio Sarrias msarrias86@gmail.com
Greene, W. H. (2012). Econometric Analysis. 7 edition. Prentice Hall.
Train, K. (2009). Discrete Choice Methods with Simulation. Cambridge university press.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66  ## Probit model
data("Workmroz")
probit < Rchoice(lfp ~ k5 + k618 + age + wc + hc + lwg + inc,
data = Workmroz, family = binomial('probit'))
summary(probit)
## Poisson model
data("Articles")
poisson < Rchoice(art ~ fem + mar + kid5 + phd + ment, data = Articles, family = poisson)
summary(poisson)
## Ordered probit model
data("Health")
oprobit < Rchoice(newhsat ~ age + educ + hhinc + married + hhkids,
data = Health, family = ordinal('probit'), subset = year == 1988)
summary(oprobit)
## Poisson Model with Random Parameters
## Not run:
poisson.ran < Rchoice(art ~ fem + mar + kid5 + phd + ment,
data = Articles, family = poisson,
ranp = c(kid5 = "n", phd = "n", ment = "n"))
summary(poisson.ran)
## Poisson Model with Correlated Random Parameters
poissonc.ran < Rchoice(art ~ fem + mar + kid5 + phd + ment,
data = Articles,
ranp = c(kid5 = "n", phd = "n", ment = "n"),
family = poisson,
correlation = TRUE)
summary(poissonc.ran)
## Hierarchical Poisson Model
poissonH.ran < Rchoice(art ~ fem + mar + kid5 + phd + ment  fem + phd,
data = Articles,
ranp = c(kid5 = "n", phd = "n", ment = "n"),
mvar = list(phd = c("fem"), ment = c("fem", "phd")),
family = poisson,
R = 10)
summary(poissonH.ran)
## 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)
summary(union.ran)
## Ordered Probit Model with Random Effects and Random Parameters
oprobit.ran < Rchoice(newhsat ~ age + educ + married + hhkids + linc,
data = Health[1:2000, ],
family = ordinal('probit'),
ranp = c(constant = "n", hhkids = "n", linc = "n"),
panel = TRUE,
index = "id",
R = 100,
print.init = TRUE)
summary(oprobit.ran)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.