Skip to contents

Estimating interactive fixed effect models.

Usage

interFE(formula = NULL, data, Y, X, index, r = 0, force = "none",
         se = TRUE, nboots = 500, seed = NULL, tol = 1e-3, 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.

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 "unit".

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.

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

Yiqing Xu <yiqingxu@stanfprd.edu>, Stanford University

Licheng Liu <liulch@mit.edu>, M.I.T.

References

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

See also

Examples

library(gsynth)
data(gsynth)
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)
#> Bootstraping...
#> Call:
#> interFE.formula(formula = Y ~ X1 + X2, data = d, index = c("id", 
#>     "time"), r = 2, force = "two-way", nboots = 50)
#> 
#> Estimated Coefficients:
#>         Coef    S.E. CI.lower CI.upper p.value
#> X1     1.021 0.03151    0.964    1.082       0
#> X2     3.052 0.03239    2.993    3.113       0
#> _const 5.005 0.13612    4.794    5.248       0