A wrapper for feglm
with
family = gaussian()
.
Arguments
- formula
an object of class
"formula"
: a symbolic description of the model to be fitted.formula
must be of typey ~ x | k
, where the second part of the formula refers to factors to be concentrated out. It is also possible to pass clustering variables tofeglm
asy ~ x | k | c
.- data
an object of class
"data.frame"
containing the variables in the model. The expected input is a dataset with the variables specified informula
and a number of rows at least equal to the number of variables in the model.- weights
an optional string with the name of the 'prior weights' variable in
data
.- control
a named list of parameters for controlling the fitting process. See
feglm_control
for details.
Value
A named list of class "felm"
. The list contains the following
eleven elements:
- coefficients
a named vector of the estimated coefficients
- fitted.values
a vector of the estimated dependent variable
- weights
a vector of the weights used in the estimation
- hessian
a matrix with the numerical second derivatives
- null_deviance
the null deviance of the model
- nobs
a named vector with the number of observations used in the estimation indicating the dropped and perfectly predicted observations
- lvls_k
a named vector with the number of levels in each fixed effect
- nms_fe
a list with the names of the fixed effects variables
- formula
the formula used in the model
- data
the data used in the model after dropping non-contributing observations
- control
the control list used in the model
References
Gaure, S. (2013). "OLS with Multiple High Dimensional Category Variables". Computational Statistics and Data Analysis, 66.
Marschner, I. (2011). "glm2: Fitting generalized linear models with convergence problems". The R Journal, 3(2).
Stammann, A., F. Heiss, and D. McFadden (2016). "Estimating Fixed Effects Logit Models with Large Panel Data". Working paper.
Stammann, A. (2018). "Fast and Feasible Estimation of Generalized Linear Models with High-Dimensional k-Way Fixed Effects". ArXiv e-prints.
Examples
# check the feglm examples for the details about clustered standard errors
# subset trade flows to avoid fitting time warnings during check
set.seed(123)
trade_2006 <- trade_panel[trade_panel$year == 2006, ]
trade_2006 <- trade_2006[sample(nrow(trade_2006), 500), ]
mod <- felm(
log(trade) ~ log_dist + lang + cntg + clny | exp_year + imp_year,
trade_2006
)
summary(mod)
#> Formula: log(trade) ~ log_dist + lang + cntg + clny | exp_year + imp_year
#> <environment: 0x568089fc78a8>
#>
#> Estimates:
#>
#> | | Estimate | Std. Error | z value | Pr(>|z|) |
#> |----------|------------|------------|-------------|------------|
#> | log_dist | -1147.0493 | 0.1035 | -11080.2479 | 0.0000 *** |
#> | lang | 444.9385 | 0.1866 | 2384.1118 | 0.0000 *** |
#> | cntg | 14533.5766 | 0.3896 | 37304.2094 | 0.0000 *** |
#> | clny | -4664.8192 | 0.3761 | -12403.7924 | 0.0000 *** |
#>
#> Significance codes: *** 99.9%; ** 99%; * 95%; . 90%
#>
#> R-squared : 0.6459
#> Adj. R-squared: 0.5078
#>
#> Number of observations: Full 500; Missing 0; Perfect classification 0