Title: | Binary Choice Models with Fixed Effects |
---|---|
Description: | Estimates fixed effects binary choice models (logit and probit) with potentially many individual fixed effects and computes average partial effects. Incidental parameter bias can be reduced with an asymptotic bias correction proposed by Fernandez-Val (2009) <doi:10.1016/j.jeconom.2009.02.007>. |
Authors: | Amrei Stammann [aut, cre], Daniel Czarnowske [aut] , Florian Heiss [aut], Daniel McFadden [ctb] |
Maintainer: | Amrei Stammann <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.7.2 |
Built: | 2024-10-30 06:51:11 UTC |
Source: | CRAN |
bias_corr
is a post-estimation routine that can be used to substantially reduce the
incidental parameter bias problem (Neyman and Scott (1948)) present in non-linear fixed effects
models (see Fernández-Val and Weidner (2018) for an overview). The command applies the analytical
bias correction derived by Fernández-Val (2009) to obtain bias-corrected estimates of
the structural parameters.
Remark: Fernández-Val (2009) further refined the bias correction of Hahn and Newey (2004). The correction is now also applicable to models with weakly exogenous regressors.
bias_corr(object, L = 0L)
bias_corr(object, L = 0L)
object |
an object of class |
L |
unsigned integer indicating a bandwidth for the estimation of spectral densities proposed by Hahn and Kuersteiner (2011). Default is zero, which should be used if all regressors are assumed to be strictly exogenous. In the presence of weakly exogenous or predetermined regressors, Fernández-Val and Weidner (2018) suggest to choose a bandwidth not higher than four. |
The function bias_corr
returns a named list of class "bife"
.
Fernández-Val, I. (2009). "Fixed effects estimation of structural parameters and marginal effects in panel probit models". Journal of Econometrics 150(1), 71-85.
Fernández-Val, I. and M. Weidner (2018). "Fixed effects estimation of large-t panel data models". Annual Review of Economics, 10, 109-138.
Hahn, J. and G. Kuersteiner (2011). "Bias reduction for dynamic nonlinear panel models with fixed effects". Econometric Theory, 27(6), 1152-1191.
Hahn, J. and W. Newey (2004). "Jackknife and analytical bias reduction for nonlinear panel models". Econometrica 72(4), 1295-1319.
Neyman, J. and E. L. Scott (1948). "Consistent estimates based on partially consistent observations". Econometrica, 16(1), 1-32.
Stammann, A., F. Heiss, and D. McFadden (2016). "Estimating Fixed Effects Logit Models with Large Panel Data". Working paper.
# Load 'psid' dataset library(bife) dataset <- psid # Fit a static logit model mod <- bife(LFP ~ I(AGE^2) + log(INCH) + KID1 + KID2 + KID3 + factor(TIME) | ID, dataset) summary(mod) # Apply analytical bias correction mod_bc <- bias_corr(mod) summary(mod_bc)
# Load 'psid' dataset library(bife) dataset <- psid # Fit a static logit model mod <- bife(LFP ~ I(AGE^2) + log(INCH) + KID1 + KID2 + KID3 + factor(TIME) | ID, dataset) summary(mod) # Apply analytical bias correction mod_bc <- bias_corr(mod) summary(mod_bc)
bife
can be used to fit fixed effects binary choice models (logit and probit)
based on an unconditional maximum likelihood approach. It is tailored for the fast estimation of
binary choice models with potentially many individual fixed effects. The routine is based on a
special pseudo demeaning algorithm derived by Stammann, Heiss, and McFadden (2016). The
estimates obtained are identical to the ones of glm
, but the computation
time of bife
is much lower.
Remark: The term fixed effect is used in econometrician's sense of having a full set of individual specific intercepts. All other parameters in the model are referred to as structural parameters.
bife( formula, data = list(), model = c("logit", "probit"), beta_start = NULL, control = list(), bias_corr = NULL, tol_demeaning = NULL, iter_demeaning = NULL, tol_offset = NULL, iter_offset = NULL )
bife( formula, data = list(), model = c("logit", "probit"), beta_start = NULL, control = list(), bias_corr = NULL, tol_demeaning = NULL, iter_demeaning = NULL, tol_offset = NULL, iter_offset = NULL )
formula |
an object of class |
data |
an object of class |
model |
the description of the error distribution and link function to be used in the model.
For |
beta_start |
an optional vector of starting values used for the structural parameters in the optimization algorithm. Default is zero for all structural parameters. |
control |
a named list of parameters for controlling the fitting process. See
|
bias_corr |
deprecated; see |
tol_demeaning , iter_demeaning , tol_offset , iter_offset
|
deprecated; see |
bife
drops all observations of cross-sectional units (individuals) with
non-varying response. This can de done because these observations do not contribute to the
identification of the structural parameters (perfect classification).
If bife
does not converge this is usually a sign of linear dependence between
one or more regressors and the fixed effects. In this case, you should carefully inspect
your model specification.
The function bife
returns a named list of class "bife"
.
Stammann, A., F. Heiss, and D. McFadden (2016). "Estimating Fixed Effects Logit Models with Large Panel Data". Working paper.
# Load 'psid' dataset library(bife) dataset <- psid # Fit a static logit model mod <- bife(LFP ~ I(AGE^2) + log(INCH) + KID1 + KID2 + KID3 + factor(TIME) | ID, dataset) summary(mod)
# Load 'psid' dataset library(bife) dataset <- psid # Fit a static logit model mod <- bife(LFP ~ I(AGE^2) + log(INCH) + KID1 + KID2 + KID3 + factor(TIME) | ID, dataset) summary(mod)
bife
Control ParametersSet and change parameters used for fitting bife
.
bife_control( dev_tol = 1e-08, iter_max = 25L, trace = FALSE, rho_tol = NULL, conv_tol = NULL )
bife_control( dev_tol = 1e-08, iter_max = 25L, trace = FALSE, rho_tol = NULL, conv_tol = NULL )
dev_tol |
tolerance level for the first stopping condition of the maximization routine. The
stopping condition is based on the relative change of the deviance in iteration |
iter_max |
unsigned integer indicating the maximum number of iterations in the maximization
routine. Default is |
trace |
logical indicating if output should be produced in each iteration. Default is |
conv_tol , rho_tol
|
deprecated; step-halving is now similar to |
The function bife_control
returns a named list of control
parameters.
coef.bife
is a generic function which extracts estimates of the structural
parameters or fixed effects from objects returned by bife
.
## S3 method for class 'bife' coef(object, type = c("sp", "fe"), corrected = NULL, fixed = NULL, ...)
## S3 method for class 'bife' coef(object, type = c("sp", "fe"), corrected = NULL, fixed = NULL, ...)
object |
an object of class |
type |
the type of parameter estimates that should be returned; structural parameters or
fixed effects. Default is |
corrected , fixed
|
deprecated. |
... |
other arguments. |
The function coef.bife
returns a named vector of estimates of the requested
parameters.
coef.bifeAPEs
is a generic function which extracts estimates of the average partial
effects from objects returned by get_APEs
.
## S3 method for class 'bifeAPEs' coef(object, ...)
## S3 method for class 'bifeAPEs' coef(object, ...)
object |
an object of class |
... |
other arguments. |
The function coef.bifeAPEs
returns a named vector of estimates of the average
partial effects.
bife
fitted valuesfitted.bife
is a generic function which extracts fitted values from an object
returned by bife
.
## S3 method for class 'bife' fitted(object, ...)
## S3 method for class 'bife' fitted(object, ...)
object |
an object of class |
... |
other arguments. |
The function fitted.bife
returns a vector of fitted values.
get_APEs
is a post-estimation routine that can be used to estimate average partial
effects with respect to all covariates in the model and the corresponding covariance matrix. The
estimation of the covariance is based on a linear approximation (delta method). Note that
the command automatically determines which of the regressors are continuous or binary.
Remark: The routine currently does not allow to compute average partial effects based on functional forms like interactions and polynomials.
Note: apeff_bife
is deprecated and will be removed soon.
get_APEs( object, n_pop = NULL, sampling_fe = c("independence", "unrestricted"), weak_exo = FALSE ) apeff_bife(...)
get_APEs( object, n_pop = NULL, sampling_fe = c("independence", "unrestricted"), weak_exo = FALSE ) apeff_bife(...)
object |
an object of class |
n_pop |
unsigned integer indicating a finite population correction for the estimation of the
covariance matrix of the average partial effects proposed by
Cruz-Gonzalez, Fernández-Val, and Weidner (2017). The correction factor is computed as follows:
|
sampling_fe |
a string equal to |
weak_exo |
logical indicating if some of the regressors are assumed to be weakly exogenous (e.g.
predetermined). If object is returned by |
... |
arguments passed to the deprecated function |
The function get_APEs
returns a named list of class "bifeAPEs"
.
Cruz-Gonzalez, M., I. Fernández-Val, and M. Weidner. (2017). "Bias corrections for probit and logit models with two-way fixed effects". The Stata Journal, 17(3), 517-545.
Fernández-Val, I. (2009). "Fixed effects estimation of structural parameters and marginal effects in panel probit models". Journal of Econometrics 150(1), 71-85.
Fernández-Val, I. and M. Weidner (2018). "Fixed effects estimation of large-t panel data models". Annual Review of Economics, 10, 109-138.
Neyman, J. and E. L. Scott (1948). "Consistent estimates based on partially consistent observations". Econometrica, 16(1), 1-32.
Stammann, A., F. Heiss, and D. McFadden (2016). "Estimating Fixed Effects Logit Models with Large Panel Data". Working paper.
# Load 'psid' dataset library(bife) dataset <- psid # Fit a static logit model mod <- bife(LFP ~ I(AGE^2) + log(INCH) + KID1 + KID2 + KID3 + factor(TIME) | ID, dataset) summary(mod) # Compute average partial effects mod_ape <- get_APEs(mod) summary(mod_ape) # Apply analytical bias correction mod_bc <- bias_corr(mod) summary(mod_bc) # Compute bias-corrected average partial effects mod_ape_bc <- get_APEs(mod_bc) summary(mod_ape_bc)
# Load 'psid' dataset library(bife) dataset <- psid # Fit a static logit model mod <- bife(LFP ~ I(AGE^2) + log(INCH) + KID1 + KID2 + KID3 + factor(TIME) | ID, dataset) summary(mod) # Compute average partial effects mod_ape <- get_APEs(mod) summary(mod_ape) # Apply analytical bias correction mod_bc <- bias_corr(mod) summary(mod_bc) # Compute bias-corrected average partial effects mod_ape_bc <- get_APEs(mod_bc) summary(mod_ape_bc)
logLik.bife
extracts the sum of the log-likelihood from an object
returned by bife
.
## S3 method for class 'bife' logLik(object, ...)
## S3 method for class 'bife' logLik(object, ...)
object |
an object of class |
... |
other arguments. |
The function logLik.bife
returns the sum of the log-likelihood.
bife
fitspredict.bife
is a generic function which obtains predictions from an object
returned by bife
.
## S3 method for class 'bife' predict( object, type = c("link", "response"), X_new = NULL, alpha_new = NULL, corrected = NULL, ... )
## S3 method for class 'bife' predict( object, type = c("link", "response"), X_new = NULL, alpha_new = NULL, corrected = NULL, ... )
object |
an object of class |
type |
the type of prediction required. |
X_new |
a data.frame or a regressor matrix for predictions. If not supplied predictions are based
on the regressor matrix returned by the object |
alpha_new |
a scalar or vector of fixed effects. If not supplied predictions are based on the
vector of fixed effects returned by |
corrected |
deprecated. |
... |
other arguments |
The model frame returned by the object bife
only includes individuals that
were not dropped before the fitting process (due to perfect classification). The linear
predictors of perfectly classified observations are equal to - Inf
or Inf
whereas
the predicted probabilities are equal to their response. In-sample predictions are only based on
non-perfectly classified observations.
If alpha_new
is supplied as a scalar the linear predictor is computed using the same
value of the fixed effect for each observation. If alpha_new
is supplied as a vector it
has to be of same length as the rows of the corresponding regressor matrix. If only X_new
is provided but not alpha_new
, we use the average.
The function predict.bife
returns a vector of predictions.
bife
print.bife
is a generic function which displays some minimal information from
objects returned by bife
.
## S3 method for class 'bife' print(x, digits = max(3L, getOption("digits") - 3L), ...)
## S3 method for class 'bife' print(x, digits = max(3L, getOption("digits") - 3L), ...)
x |
an object of class |
digits |
unsigned integer indicating the number of decimal places. Default is
|
... |
other arguments. |
bifeAPEs
print.bifeAPEs
is a generic function which displays some minimal information from
objects returned by get_APEs
.
## S3 method for class 'bifeAPEs' print(x, digits = max(3L, getOption("digits") - 3L), ...)
## S3 method for class 'bifeAPEs' print(x, digits = max(3L, getOption("digits") - 3L), ...)
x |
an object of class |
digits |
unsigned integer indicating the number of decimal places. Default is
|
... |
other arguments. |
summary.bife
print.summary.bife
is a generic function which displays summary statistics from
objects returned by summary.bife
.
## S3 method for class 'summary.bife' print(x, digits = max(3L, getOption("digits") - 3L), ...)
## S3 method for class 'summary.bife' print(x, digits = max(3L, getOption("digits") - 3L), ...)
x |
an object of class |
digits |
unsigned integer indicating the number of decimal places. Default is
|
... |
other arguments. |
summary.bifeAPEs
print.summary.bifeAPEs
is a generic function which displays summary statistics from
objects returned by summary.bifeAPEs
.
## S3 method for class 'summary.bifeAPEs' print(x, digits = max(3L, getOption("digits") - 3L), ...)
## S3 method for class 'summary.bifeAPEs' print(x, digits = max(3L, getOption("digits") - 3L), ...)
x |
an object of class |
digits |
unsigned integer indicating the number of decimal places. Default is
|
... |
other arguments. |
The sample was obtained from the "Panel Study of Income Dynamics" and
contains information about women that were observed over
years.
psid
psid
A data frame with 13,149 rows:
individual identifier
labor force participation
# of kids aged between 0 and 2
# of kids aged between 3 and 5
# of kids aged between 6 and 17
income husband
age of woman
time identifier
Hyslop, D. (1999). "State Dependence, Serial Correlation and Heterogeneity in Intertemporal Labor Force Participation of Married Women". Econometrica 67(6), 1255-1294.
Fernandez-Val, I. (2009). "Fixed effects estimation of structural parameters and marginal effects in panel probit models". Journal of Econometrics 150(1), 71-85.
bife
Summary statistics for objects of class "bife"
.
## S3 method for class 'bife' summary(object, type = c("sp", "fe"), corrected = NULL, fixed = NULL, ...)
## S3 method for class 'bife' summary(object, type = c("sp", "fe"), corrected = NULL, fixed = NULL, ...)
object |
an object of class |
type |
the type of parameter estimates the summary statistics are related to: structural
parameters or fixed effects. Default is |
corrected , fixed
|
deprecated. |
... |
other arguments. |
Returns an object of class "summary.bife"
which is a list of summary statistics of
object
.
bifeAPEs
Summary statistics for objects of class "bifeAPEs"
.
## S3 method for class 'bifeAPEs' summary(object, ...)
## S3 method for class 'bifeAPEs' summary(object, ...)
object |
an object of class |
... |
other arguments. |
Returns an object of class "summary.bifeAPEs"
which is a list of summary statistics of
object
.
vcov.bife
computes an estimate of the covariance matrix of the estimator of the
structural parameters from objects returned by bife
. The estimate is obtained
using the inverse of the negative Hessian after convergence.
## S3 method for class 'bife' vcov(object, ...)
## S3 method for class 'bife' vcov(object, ...)
object |
an object of class |
... |
other arguments. |
The function vcov.bife
returns a named matrix of covariance estimates.
vcov.bifeAPEs
computes an estimate of the covariance matrix of the estimator of the
average partial parameters from objects returned by get_APEs
.
## S3 method for class 'bifeAPEs' vcov(object, ...)
## S3 method for class 'bifeAPEs' vcov(object, ...)
object |
an object of class |
... |
other arguments. |
The function vcov.bifeAPEs
returns a named matrix of covariance estimates.