interFE: Interactive Fixed Effects Models

View source: R/interFE.R

interFER Documentation

Interactive Fixed Effects Models

Description

Estimating interactive fixed effect models.

Usage

interFE(formula = NULL, data, Y, X = NULL, W = NULL,
         index, r = 0, force = "two-way",
         se = FALSE, nboots = 500, seed = NULL, 
         tol = 1e-3, max_iteration = 500, 
         binary = FALSE, QR = FALSE, normalize = FALSE)

Arguments

formula

an object of class "formula": a symbolic description of the model to be fitted.

data

a data frame.

Y

outcome variable.

X

time-varying covariates.

W

weights.

index

a two-element string vector specifying the unit (group) and time indicators.

r

an integer specifying the number of factors.

force

a string indicating whether unit/time/both fixed effects will be imposed: "none", "unit", "time", or "two-way".

se

logical; if TRUE, computes bootstrap-based standard errors.

nboots

number of bootstrap runs (ignored if se=FALSE).

seed

random seed.

tol

tolerance for EM algorithm.

max_iteration

max number of EM iterations.

binary

logical flag for a probit link (not fully supported here).

QR

logical flag for QR-based factor analysis in probit model (not fully supported).

normalize

logical; if TRUE, scales outcome/covariates.

Details

interFE estimates interactive fixed effect models as in Bai (2009).

Value

beta

estimated coefficients.

mu

estimated grand mean.

factor

estimated time-varying factors.

lambda

estimated factor loadings.

VNT

diagonal matrix of r eigenvalues.

niter

number of iterations before convergence.

alpha

estimated unit fixed effects (if imposed).

xi

estimated time fixed effects (if imposed).

residuals

model residuals.

sigma2

residual mean squared error.

IC

information criterion.

ValidX

logical for whether valid covariates exist.

dat.Y

matrix of outcome data.

dat.X

array of independent variables.

Y

name of the outcome variable.

X

name of time-varying control variables.

index

name of unit/time indicators.

est.table

table of final estimates.

est.boot

matrix of bootstrap results.

Author(s)

Licheng Liu; Ye Wang; Yiqing Xu

References

Bai, J. (2009). Panel data models with interactive fixed effects. Econometrica, 77(4), 1229-1279.

See Also

print.interFE, fect

Examples

library(fect)
data(fect)
d <- simdata[-(1:150),] # remove the treated units
out <- interFE(Y ~ X1 + X2, data = d, index=c("id","time"),
               r = 2, force = "two-way", nboots = 50)

xuyiqing/fect documentation built on April 12, 2025, 9:50 p.m.