This is how fas as I got, in a reproducible example:
Code:
sysuse auto, clear *V(Y) sum price *V(E(Y|X) : un reg on FEs and calculte their average egen make2=group(make) reg price i.make2, nocons matrix FEs = e(b) scalar V_FEs= mean(FEs) // this is giving an the erro message unknown function mean() *E(V(Y|X)) predict y_resid, resid *somehow compute the by group variance and average them
0 Response to Compute sample analog of law of total variance [ V(Y) = E(V(Y|X)) + V(E(Y|X)]
Post a Comment