I have an unbalanced panel data and all the variables are defined from year 2004 to 2012.
It is a biennial survey dataset. I created it using xtset kidid Year, delta(2)
I want to evaluate whether health of the parents in 2004 , 2006 and 2008 has impacted on the help received from the children in year 2008 , 2010 and 2012.
That is to say, independent variables and dependent variable belong to different years.
Or the idea is like this :
regress (dependent in 2008 ,2010, 2012) on ( independent in 2004,2006 , 2008)
The independent control variables are defined in a local macro using factor like below:
local Var_Robustness i.Year ib(first).ParentAge i.ParentAgesquared ib(first).Race ib(first).Education
The health indicator of the parents is
The dependent variable is FinTrFromChild
I tried code below:
gen FinTrFromChildlead=L2.FinTrFromChild
gen HStayl=F2.HStay
foreach Var_Robustness in Year ParentAge ParentAgesquared Race Education {
gen l_`Var_Robustness' = L2.`Var_Robustness'
}
xtreg FinTrFromChildlead ib(first).HStayl `l_Var_Robustness' if Gender==1 ,fe cluster(hhid)
stata reports : insufficient observations
parts of the summary in stata output:
. tab HStay Year
| Year
HStay | 2004 2006 2008 2010 2012 | Total
----------------------+-------------------------------------------------------+----------
No Hospital Stay | 11,096 10,870 10,543 12,378 12,771 | 57,658
One or More Hospital | 4,663 4,731 4,800 6,098 5,206 | 25,498
----------------------+-------------------------------------------------------+----------
Total | 15,759 15,601 15,343 18,476 17,977 | 83,156
. tab HStayl Year
| Year
HStayl | 2004 2006 2008 | Total
-----------+---------------------------------+----------
0 | 6,847 6,337 6,641 | 19,825
1 | 3,275 3,402 2,891 | 9,568
-----------+---------------------------------+----------
Total | 10,122 9,739 9,532 | 29,393
. tab FinTrFromChildlead Year
FinTrFromC | Year
hildlead | 2008 2010 2012 | Total
-----------+---------------------------------+----------
0 | 9,635 8,783 9,080 | 27,498
1 | 393 284 347 | 1,024
-----------+---------------------------------+----------
Total | 10,028 9,067 9,427 | 28,522
. tab FinTrFromChild Year
k7fcany:w7 |
any |
transfer | Year
from kid | 2004 2006 2008 2010 2012 | Total
-----------+-------------------------------------------------------+----------
0.no | 14,980 13,581 14,534 17,575 17,046 | 77,716
1.yes | 569 452 527 557 508 | 2,613
-----------+-------------------------------------------------------+----------
Total | 15,549 14,033 15,061 18,132 17,554 | 80,329
Appreciate your help on how to correct this.
It is a biennial survey dataset. I created it using xtset kidid Year, delta(2)
I want to evaluate whether health of the parents in 2004 , 2006 and 2008 has impacted on the help received from the children in year 2008 , 2010 and 2012.
That is to say, independent variables and dependent variable belong to different years.
Or the idea is like this :
regress (dependent in 2008 ,2010, 2012) on ( independent in 2004,2006 , 2008)
The independent control variables are defined in a local macro using factor like below:
local Var_Robustness i.Year ib(first).ParentAge i.ParentAgesquared ib(first).Race ib(first).Education
The health indicator of the parents is
HStay(hospital stay)
The dependent variable is FinTrFromChild
I tried code below:
gen FinTrFromChildlead=L2.FinTrFromChild
gen HStayl=F2.HStay
foreach Var_Robustness in Year ParentAge ParentAgesquared Race Education {
gen l_`Var_Robustness' = L2.`Var_Robustness'
}
xtreg FinTrFromChildlead ib(first).HStayl `l_Var_Robustness' if Gender==1 ,fe cluster(hhid)
stata reports : insufficient observations
parts of the summary in stata output:
. tab HStay Year
| Year
HStay | 2004 2006 2008 2010 2012 | Total
----------------------+-------------------------------------------------------+----------
No Hospital Stay | 11,096 10,870 10,543 12,378 12,771 | 57,658
One or More Hospital | 4,663 4,731 4,800 6,098 5,206 | 25,498
----------------------+-------------------------------------------------------+----------
Total | 15,759 15,601 15,343 18,476 17,977 | 83,156
. tab HStayl Year
| Year
HStayl | 2004 2006 2008 | Total
-----------+---------------------------------+----------
0 | 6,847 6,337 6,641 | 19,825
1 | 3,275 3,402 2,891 | 9,568
-----------+---------------------------------+----------
Total | 10,122 9,739 9,532 | 29,393
. tab FinTrFromChildlead Year
FinTrFromC | Year
hildlead | 2008 2010 2012 | Total
-----------+---------------------------------+----------
0 | 9,635 8,783 9,080 | 27,498
1 | 393 284 347 | 1,024
-----------+---------------------------------+----------
Total | 10,028 9,067 9,427 | 28,522
. tab FinTrFromChild Year
k7fcany:w7 |
any |
transfer | Year
from kid | 2004 2006 2008 2010 2012 | Total
-----------+-------------------------------------------------------+----------
0.no | 14,980 13,581 14,534 17,575 17,046 | 77,716
1.yes | 569 452 527 557 508 | 2,613
-----------+-------------------------------------------------------+----------
Total | 15,549 14,033 15,061 18,132 17,554 | 80,329
Appreciate your help on how to correct this.
Comment