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 (must be with a dichotomous treatment but balanced is not required).

Y

outcome.

X

time-varying covariates.

W

weights.

index

a two-element string vector specifying the unit (group) and time indicators. Must be of length 2.

r

an integer specifying the number of factors.

force

a string indicating whether unit or time fixed effects will be imposed. Must be one of the following, "none", "unit", "time", or "two-way". The default is "two-way".

se

a logical flag indicating whether uncertainty estimates will be produced via bootstrapping.

nboots

an integer specifying the number of bootstrap runs. Ignored if se = FALSE.

seed

an integer that sets the seed in random number generation. Ignored if se = FALSE and r is specified.

tol

a numeric value that specifies tolerate level.

max_iteration

the maximal number of iterations for the EM algorithm.

binary

a logical flag indicating whether a probit link function will be used.

QR

a logical flag indicating whether QR decomposition will be used for factor analysis in probit model.

normalize

a logic flag indicating whether to scale outcome and covariates. Useful for accelerating computing speed when magnitude of data is large.The default is normalize=FALSE.

Details

interFE estimates interactive fixed effect models proposed by Bai (2009).

Value

beta

estimated coefficients.

mu

estimated grand mean.

factor

estimated factors.

lambda

estimated factor loadings.

VNT

a diagonal matrix that consists of the r eigenvalues.

niter

the number of iteration before convergence.

alpha

estimated unit fixed effect (if force is "unit" or "two-way").

xi

estimated time fixed effect (if force is "time" or "two-way").

residuals

residuals of the estimated interactive fixed effect model.

sigma2

mean squared error of the residuals.

IC

the information criterion.

ValidX

a logical flag specifying whether there are valid covariates.

dat.Y

a matrix storing data of the outcome variable.

dat.X

an array storing data of the independent variables.

Y

name of the outcome variable.

X

name of the time-varying control variables.

index

name of the unit and time indicators.

est.table

a table of the estimation results.

est.boot

a matrix storing results from bootstraps.

Author(s)

Licheng Liu; Ye Wang; Yiqing Xu

References

Jushan Bai. 2009. "Panel Data Models with Interactive Fixed Effects." Econometrica 77:1229–1279.

See Also

print.interFE and fect

Examples

library(fect)
data(fect)
d <- simdata1[-(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 March 30, 2024, 10:10 a.m.