I'm trying to fill a table with each line representing the explanatory power of a particular part of my model (such as fixed effects, independent variables, the residuals...), that is, the variance of this specific part divided by the variance of the model.
Independant variables | Var(xb)/Var(model) |
Fixed effect 1 | Var(fe1)/Var(model) |
Residuals | Var(residuals)/Var(model) |
Interaction term | ? |
So what I do is that I use the command from SSC -reghdfe- to store my fixed effects in a variable, as well as the command -predict- to save the xb and the residuals in a variable.
Code:
reghdfe y var1 var2 var3 i.var4##i.var5, absorb(fe1 fe2, savefe) resid predict xb, xb predict residuals, r
Code:
sum xb display r(Var)/`variance' sum __hdfe1__ display r(Var)/`variance' * __hdfe1__ is obtained with the savefe option
Now my problem is that xb is for all the independent variables, including the interaction term. How can I possibly isolate the variance of the different levels of the interaction term to fill the last cell of the table? My lead so far has been to generate manually a variable representing the interaction term between var4 and var5 and to put it in the fixed effect option in the regression, but it seems that the command xi generates an important quantity of variables for each combination of var4 and var5. I'm not sure this is what I want. Apologies if my post isn't clear (and it probably is!). I can explain further if needed.
0 Response to Determining the explanatory power of an interaction term
Post a Comment