*! version 1.0 6 Sep 2020

Title

twest -- performs the last step of the algorithm based on the model of Somaini and Wolak (2016).

Syntax

twest command varlist
[,
options]

Command is an estimation command, e.g., regress, ivregress, sureg. The varlist contains the dependent variable followed by the independent variables. The syntaxis of the varlist replicates the syntaxis of the original estimation command.

SE/Robust
+ vce(vcetype) vcetype
may be unadjusted (default), robust or cluster

Description

twest performs the last step of the algorithm, making the regression of the projected variables

Options

Full Description

Shortcomings

1. Factor-variable and time-series operators not allowed.

Common Errors

1. Running twres after some other comment erased or overwrote eresults.

2. Using the vce with the "sureg" command.

Examples

twest reg w_y w_x*, vce(cluster hhid)

twest ivregress w_y w_x1 w_x2 (w_x3= w_x4 w_x5), vce(robust)

Stored results

Note: All the results of the original command selected and the matrices and scalars needed for the algorithm will be stored in eresults. Use ereturn to list them.

Scalars
e(dof_adj) Degree of freedom adjustment

e(dimN) number of first fixed effect without the redundants observations

e(dimT) number of second fixed effect without the redundants observations

e(nested_adj) Adjustment in the degree of freedom if one of the fixed effect or both of them are nested within the cluster var

e(rank_adj) Adjustment based on the rank of e(A) if e(dimN)<e(dimT), otherwise is based on the rank of e(C)

Macros
e(absorbed) name of the fixed effects absorbed and the weight variable

Matrices
e(b) coefficient vector

e(V) variance-covariance matrix adjusted of the estimators

If "using" is omitted

e(invDD) is a vector of (dimN)x1 taking the diagonal elements of the inverse of the matrix D'D

e(invHH) is a vector of (dimT-1)x1 taking the diagonal elements of the inverse of the matrix H'H

e(B) Matrix B needed for the first and second step of the algorithm

If e(dimN)<e(dimT)

e(A) Matrix A needed for the first and second step of the algorithm

e(CinvHHDH) Matrix CinvHHDH needed for the first and second step of the algorithm

If e(dimN)>=e(dimT)

e(C) Matrix C needed for the first and second step of the algorithm

e(AinvDDDH) Matrix AinvDDDH needed for the first step of the algorithm

Functions
e(sample) marks estimation sample

More information

For more information of twest Github

Also see

For advanced options:
twset
twres
twsave
twload
twfem

References

Somaini, P. and F.A. Wolak, (2015), An Algorithm to Estimate the Two-Way Fixed Effects Model, Journal of Econometric Methods, 5, issue 1, p. 143-152.

Aditional References

Arellano, M. (1987), Computing Robust Standard Errors for Within-Groups Estimators, Oxford Bulletin of Economics and Statistics, 49, issue 4, p. 431–434.

Cameron, A. C., & Miller, D. L. (2015). A practitioner’s guide to cluster-robust inference. Journal of human resources, 50(2), 317-372.