binaryChoice: Binary choice models.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/binaryChoice.R

Description

Binary Choice models. These models are estimated by binaryChoice, intended to be called by wrappers like probit.

Usage

1
2
3
4
5
6
7
8
9
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",
             ... )

Arguments

formula

a symbolic description of the model to be fit, in the form response ~ explanatory variables (see also details).

weights

an optional vector of ‘prior weights’ to be used in the fitting process. Should be NULL or a numeric vector.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

na.action

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.

start

inital value of parameters.

data

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.

x, y, model

logicals. If TRUE the corresponding components of the fit (the model matrix, the response, the model frame) are returned.

method

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).

userLogLik

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.

cdfLower, cdfUpper, pdf, gradPdf

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.

logCdfLower, logCdfUpper, logPdf

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.

maxMethod

character, a maximisation method supported by maxLik. This is only useful if using a user-supplied likelihood function.

...

further arguments for binaryChoice and maxLik.

Details

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.

Value

An object of class "binaryChoice". It is a list with following components:

LRT

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)

LRT is distributed by chi2(df) under H0.

param

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

df.residual

degrees of freedom of the residuals.

x

if requested, the model matrix used.

y

if requested, the model response used. The response is represented internally as 0/1 integer vector.

model

the model frame, only if model = TRUE or method = "model.frame".

na.action

information returned by model.frame on the special handling of NA s.

Other components are inherited from maxLik.

probit adds class "probit" and following components to the "binaryChoice" object:

family

the family object used (binomial with link="probit")

Author(s)

Ott Toomet otoomet@ut.ee, Arne Henningsen

References

Demidenko, Eugene (2001) “Computational aspects of probit model”, Mathematical Communications 6, 233-247

See Also

maxLik for ready-packaged likelihood maximisation routines and methods, glm for generalised linear models, including probit, binomial, and probit-methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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))

Example output

Loading required package: maxLik
Loading required package: miscTools

Please cite the 'maxLik' package as:
Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI 10.1007/s00180-010-0217-1.

If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's R-Forge site:
https://r-forge.r-project.org/projects/maxlik/
--------------------------------------------
Probit binary choice model/Maximum Likelihood estimation
Newton-Raphson maximisation, 5 iterations
Return code 1: gradient close to zero (gradtol)
Log-Likelihood: -46.06895 
Model: Y == 'TRUE' in contrary to 'FALSE'
100 observations (23 'negative' and 77 'positive') and 2 free parameters (df = 98)
Estimates:
            Estimate Std. error t value   Pr(> t)    
(Intercept) -0.11771    0.25708 -0.4579 0.6470562    
x            1.95465    0.52717  3.7078 0.0002091 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Significance test:
chi2(1) = 15.71736 (p=7.354591e-05)
--------------------------------------------
--------------------------------------------
Probit binary choice model/Maximum Likelihood estimation
Newton-Raphson maximisation, 4 iterations
Return code 8: successive function values within relative tolerance limit (reltol)
Log-Likelihood: -435.1312 
Model: Y == '1' in contrary to '0'
753 observations (325 'negative' and 428 'positive') and 10 free parameters (df = 743)
Estimates:
                Estimate  Std. error t value   Pr(> t)    
(Intercept)   9.7472e+00  1.1399e+00  8.5510 < 2.2e-16 ***
kidsTRUE     -2.3059e-01  1.3523e-01 -1.7051 0.0881666 .  
age30.39TRUE  1.7823e-01  1.1702e-01  1.5231 0.1277444    
age50.60TRUE -5.1400e-01  1.4898e-01 -3.4501 0.0005605 ***
educ          1.2152e-01  3.0062e-02  4.0423 5.293e-05 ***
hushrs       -7.3534e-04  1.0388e-04 -7.0791 1.451e-12 ***
huseduc      -3.0972e-02  2.2452e-02 -1.3794 0.1677569    
huswage      -2.1450e-01  2.4015e-02 -8.9316 < 2.2e-16 ***
mtr          -1.0490e+01  1.1529e+00 -9.0990 < 2.2e-16 ***
motheduc     -5.8362e-03  1.6638e-02 -0.3508 0.7257541    
---
Signif. codes:  0***0.001**0.01*0.05.’ 0.1 ‘ ’ 1
Significance test:
chi2(9) = 159.4841 (p=9.505426e-30)
--------------------------------------------

sampleSelection documentation built on Jan. 13, 2021, 7:49 p.m.