Estimates fixed effects individual slope estimators by applying linear lm models to "detrended" data.
feis( formula, data, id, weights =NULL, robust =FALSE, intercept =FALSE, dropgroups =FALSE, tol = .Machine$double.eps,...)## S3 method for class 'feis'formula(x, lhs =NULL, rhs =NULL,...)## S3 method for class 'feis'terms(x, lhs =NULL, rhs =NULL,...)## S3 method for class 'feis'residuals(object,...)## S3 method for class 'feis'df.residual(object,...)## S3 method for class 'feis'coef(object,...)## S3 method for class 'feis'sigma(object,...)## S3 method for class 'feis'deviance(object,...)## S3 method for class 'feis'nobs(object,...)## S3 method for class 'feis'fitted(object,...)## S3 method for class 'feis'hatvalues(model,...)
Arguments
formula: a symbolic description for the model to be fitted (see Details).
data: a data.frame containing the specified variables.
id: the name of a unique group / person identifier (as string).
weights: an optional vector of weights to be used in the fitting process. See lm.
robust: logical. If TRUE estimates cluster robust standard errors (default is FALSE).
intercept: logical. If TRUE estimates the model with an intercept (default is FALSE).
dropgroups: logical. If TRUE groups without any within variance on a slope variable are dropped , if FALSE those variables are omitted for the respective groups only (default is FALSE).
tol: the tolerance for detecting linear dependencies in the residual maker transformation (see solve). The argument is forwarded to bsfeistest.
...: further arguments.
lhs, rhs: indexes of the left- and right-hand side for the methods formula and terms.
object, x, model: an object of class "feis".
Returns
An object of class "feis", containing the following elements: - coefficients: the vector of coefficients.
vcov: the scaled (if specified, robust) variance-covariance matrix of the coefficients. See vcov.feis for unscaled vcov. - residuals: the vector of residuals (computed from the "detrended" data).
df.residual: degrees of freedom of the residuals.
formula: an object of class "Formula" describing the model.
model: the original model frame as a data.frame containing the original variables used for estimation.
modelhat: a constructed model frame as a data.frame containing the predicted values from the first stage regression using the slope variable(s) as predictor(s).
modeltrans: a constructed model frame as a data.frame containing the "detrended" variables used for the final model estimation. Note that the weights are already used for detrending if specified.
response: the vector of the "detrended" response variable.
fitted.values: the vector of fitted values (computed from the "detrended" data).
id: a vector containing the unique person identifier.
weights: a vector containing weights used in fitting, or integer 1 if not speficied in call.
call: the matched call.
assign: assign attributes of the formula.
na.omit: (where relevant) a vector of the omitted observations. The only handling method of NAs is "omit".
contrasts: (only where relevant) the contrasts used.
arg: a list containing the used methods. Only "feis" and "individual" effects available.
slopevars: a character vector containing the names of the slope variables.
r2: R squared of the "detrended" model.
adj.r2: adjusted R squared of the "detrended" model.
vcov_arg: a character containing the method used to compute the variance-covariance matrix.
tol: the tolerance parameter (for use in bsfeistest).
Details
feis is a special function to estimate linear fixed effects models with individual-specific slopes. In contrast to conventional fixed effects models, data are not person "demeaned", but "detrended" by the predicted individual slope of each person if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="Bruderl.2015.387,Ruttenauer.2020,Wooldridge.2010.384",package="feisr",cached_env=.Rdpack.currefs) .
Estimation requires at least q+1 observations per unit, where q is the number of slope parameters (including a constant). feis automatically selects only those groups from the current data set which have at least q+1 observations. The function returns a warning if units with <q+1 observations are dropped.
The function requires a two-part formula, in which the second part indicates the slope parameter(s). If, for example, the model is y ~ x1 + x2, with the slope variables x3 and x4, the model can be estimated with:
formula = y ~ x1 + x2 | x3 + x4
To estimate a conventional fixed effects model without individual slopes, please use y ~ x1 + x2 | 1 to indicate that the slopes should only contain an individual-specific intercept.
If specified, feis estimates panel-robust standard errors. Panel-robust standard errors are robust to arbitrary forms of serial correlation within groups formed by id as well as heteroscedasticity across groups if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="@see @Wooldridge.2010.384, pp.379-381",package="feisr", cached_env=.Rdpack.currefs) .
The model output can be exported using the texreg package.