| apes {capybara} | R Documentation |
Compute average partial effects after fitting binary choice models with a 1,2,3-way error component
Description
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) plus an optional finite population correction. Note that the command automatically determines which of the regressors are binary or non-binary.
Remark: The routine currently does not allow to compute average partial effects based on functional forms like interactions and polynomials.
Usage
apes(
object = NULL,
n_pop = NULL,
panel_structure = c("classic", "network"),
sampling_fe = c("independence", "unrestricted"),
weak_exo = FALSE
)
Arguments
object |
an object of class "bias_corr" or "feglm"; currently restricted to
binomial.
|
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: (n^{\ast} - n) / (n^{\ast} - 1), where
n^{\ast} and n are the sizes of the entire population and the full sample size. Default is
NULL, which refers to a factor of zero and a covariance obtained by the delta method.
|
panel_structure |
a string equal to "classic" or "network" which determines the structure of the
panel used. "classic" denotes panel structures where for example the same cross-sectional units are observed
several times (this includes pseudo panels). "network" denotes panel structures where for example bilateral
trade flows are observed for several time periods. Default is "classic".
|
sampling_fe |
a string equal to "independence" or "unrestricted" which imposes sampling
assumptions about the unobserved effects. "independence" imposes that all unobserved effects are independent
sequences. "unrestricted" does not impose any sampling assumptions. Note that this option only affects the
optional finite population correction. Default is "independence".
|
weak_exo |
logical indicating if some of the regressors are assumed to be weakly exogenous (e.g. predetermined).
If object is of class "bias_corr", the option will be automatically set to TRUE if the chosen
bandwidth parameter is larger than zero. Note that this option only affects the estimation of the covariance matrix.
Default is FALSE, which assumes that all regressors are strictly exogenous.
|
Value
The function apes returns a named list of class "apes".
References
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.
Czarnowske, D. and A. Stammann (2020). "Fixed Effects Binary Choice Models: Estimation and Inference with Long Panels". ArXiv e-prints. @references Fernández-Val, I. and M. Weidner (2016). "Individual and time effects in nonlinear panel models with large N, T". Journal of Econometrics, 192(1), 291-312.
Fernández-Val, I. and M. Weidner (2018). "Fixed effects estimation of large-t panel data models". Annual Review of Economics, 10, 109-138.
Hinz, J., A. Stammann, and J. Wanner (2020). "State Dependence and Unobserved Heterogeneity in the Extensive Margin of Trade". ArXiv e-prints.
Neyman, J. and E. L. Scott (1948). "Consistent estimates based on partially consistent observations". Econometrica, 16(1), 1-32.
See Also
bias_corr and feglm
Examples
mtcars2 <- mtcars
mtcars2$mpg01 <- ifelse(mtcars2$mpg > mean(mtcars2$mpg), 1L, 0L)
# Fit 'feglm()'
mod <- feglm(mpg01 ~ wt | cyl, mtcars2, family = binomial())
# Compute average partial effects
mod_ape <- 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 <- apes(mod_bc)
summary(mod_ape_bc)