Binary Choice models. These models are estimated by
binaryChoice
, intended to be called by wrappers like
probit
.
probit(formula, weights = NULL, ...)
binaryChoice(formula, subset, na.action, start = NULL, data = sys.frame(sys.parent()),
x=FALSE, y = FALSE, model = FALSE, method="ML",
userLogLik=NULL,
cdfLower, cdfUpper=function(x) 1 - cdfLower(x),
logCdfLower=NULL, logCdfUpper=NULL,
pdf, logPdf=NULL, gradPdf,
maxMethod="Newton-Raphson",
... )
a symbolic description of the model to be fit, in the
form response ~ explanatory variables
(see also details).
an optional vector of ‘prior weights’ to be used in the fitting process. Should be NULL or a numeric vector.
an optional vector specifying a subset of observations to be used in the fitting process.
a function which indicates what should happen when the data contain 'NA's. The default is set by the 'na.action' setting of 'options', and is 'na.fail' if that is unset. The 'factory-fresh' default is 'na.omit'. Another possible value is 'NULL', no action. Value 'na.exclude' can be useful.
inital value of parameters.
an optional data frame containing the variables in the
model. If not found in data, the
variables are taken from environment(formula), typically the
environment from which probit
is called.
logicals. If TRUE the corresponding components of the fit (the model matrix, the response, the model frame) are returned.
the method to use; for fitting, currently only method = "ML" (Maximum Likelihood) is supported; method = "model.frame" returns the model frame (the same as with model = TRUE, see below).
log-likelihood function. A function of the
parameter to be estimated, which computes
the log likelihood. If supplied, it will be used instead of
cdfLower
and similar parameters. This allows user to
fine-tune the likelihood function such as introducing robust
approximations. It might return the corresponding gradient and
Hessian as approximations, see maxNR
.
function, lower and upper tail of the cumulative distribution function of the disturbance term, corresponding probability density function, and gradient of the density function. These functions must take a numeric vector as the argument, and return numeric vector of the probability/gradient values.
logs of the corresponding functions. Providing these may improve precision in extreme tail. If not provided, simply logs are takes of the corresponding non-log values.
character, a maximisation method supported by
maxLik
. This is only useful if using
a user-supplied likelihood function.
further arguments for binaryChoice
and
maxLik
.
An object of class "binaryChoice". It is a list with following components:
Likelihood ration test. The full model is tested against H0: the parameters (besides constant) have no effect on the result. This is a list with components
LRTThe LRT value
dfDegrees of freedom for LRT (= df of the model - 1)
A list with following background information:
nParamNumber of parameters of the model including constant
nObsNumber of the observations
N1Number of observations with non-zero (true) response
N0Number of observations with zero (false) response
degrees of freedom of the residuals.
if requested, the model matrix used.
if requested, the model response used. The response is represented internally as 0/1 integer vector.
the model frame, only if model = TRUE
or
method = "model.frame"
.
information returned by model.frame
on
the special handling of NA s.
probit adds class "probit" and following components to the "binaryChoice" object:
the family object used (binomial
with
link="probit"
)
The dependent variable for the binary choice models must have exactly two levels (e.g. '0' and '1', 'FALSE' and 'TRUE', or 'no' and 'yes'). Internally, the first level is always coded '0' ('failure') and the second level as '1' ('success'), no matter of the actual value. However, by default the levels are ordered alphabetically and this makes puts '1' after '0', 'TRUE' after 'FALSE' nad 'yes' after 'no'.
Via the distribution function parameters, binaryChoice
supports generic latent linear index binary choice models with
additive disturbance terms. It is intended to be called by wrappers
like probit
. However, it is also visible in the namespace as
the user may want to implement her own models using another
distribution of the disturbance term.
The model is estimated using Maximum Likelihood and Newton-Raphson optimizer.
probit
implements an outlier-robust log-likelihood (Demidenko,
2001). In case of large outliers the analytic Hessian is
singular while Fisher scoring approximation (used, for instance, by
glm
) is invertible. Those values are not
reliable in case of outliers.
No attempt is made to establish the existence of the estimator.
Demidenko, Eugene (2001) “Computational aspects of probit model”, Mathematical Communications 6, 233-247
maxLik
for ready-packaged likelihood maximisation
routines and methods, glm
for generalised linear models,
including probit, binomial
, and probit-methods
.
# NOT RUN {
## A simple MC trial: note probit assumes normal errors
x <- runif(100)
e <- 0.5*rnorm(100)
y <- x + e
summary(probit((y > 0) ~ x))
## female labour force participation probability
data(Mroz87)
Mroz87$kids <- Mroz87$kids5 > 0 | Mroz87$kids618 > 0
Mroz87$age30.39 <- Mroz87$age < 40
Mroz87$age50.60 <- Mroz87$age >= 50
summary(probit(lfp ~ kids + age30.39 + age50.60 + educ + hushrs +
huseduc + huswage + mtr + motheduc, data=Mroz87))
# }
Run the code above in your browser using DataLab