I would greatly appreciate your thoughts on my approach to estimate the effect of a between-subjects intervention while accounting for subject fixed effects.
Setup
I have a data set (see end for example) with multiple observations per individual, and both between- and within-subjects interventions.
Problem
However, I would like to also account for individual fixed effects. Pesaran and Zhou (2016, Econometric Reviews) demonstrate a two-step procedure to estimate time-invariant effects while accounting for fixed effects:
The Stata command xtfef (written by Law and Zhou) implements this procedure, but does not provide the baseline average of the fixed effects for the omitted group AX (i.e., the intercept).
My approach
I'm considering the following simpler, and hopefully transparent approach.
Regress the within-subjects intervention Y on individuals under A and B separately:
Then, I take the difference in the "constants" of Equation 1 and Equation 2 as the effect of B. (The point estimate is the same as from xtfef code.) For the standard error of this difference, I use the Delta method (square root of SE(constant1)^2 + SE(constant2)^2). This way, I have the average output across all four groups with the individual fixed-effects partialed out.
Any red flags? Thanks in advance for all your help!
Setup
I have a data set (see end for example) with multiple observations per individual, and both between- and within-subjects interventions.
- Each individual is given 1 of 2 tasks, A and B (between-subjects intervention).
- Individuals do the task in several rounds, and each round presents the task in 1 of 2 ways, X and Y (within-subjects intervention).
- The outcome is performance in the task, measured by a variable called "output".
Code:
reg output 1.B##1.Y, cl(id)
However, I would like to also account for individual fixed effects. Pesaran and Zhou (2016, Econometric Reviews) demonstrate a two-step procedure to estimate time-invariant effects while accounting for fixed effects:
- Run the fixed-effects regression without the time-invariant variable (B in this case).
- Regress the residuals from the FE regression on the time-invariant variable.
The Stata command xtfef (written by Law and Zhou) implements this procedure, but does not provide the baseline average of the fixed effects for the omitted group AX (i.e., the intercept).
My approach
I'm considering the following simpler, and hopefully transparent approach.
Regress the within-subjects intervention Y on individuals under A and B separately:
Code:
xtreg output Y if B==0, cl(id) fe // Equation 1 xtreg output Y if B==1, cl(id) fe // Equation 2
Any red flags? Thanks in advance for all your help!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int(id round B Y output) 1 1 1 0 1 1 2 1 1 7 1 3 1 0 6 2 1 1 1 6 2 2 1 0 7 2 3 1 1 1 3 1 1 0 6 3 2 1 1 0 3 3 1 0 6 4 1 0 1 9 4 2 0 0 2 4 3 0 1 0 5 1 0 0 4 5 2 0 1 9 5 3 0 0 5 6 1 0 1 9 6 2 0 0 2 6 3 0 1 6 end
Comment