Dear all, I am new on panel analysis and so sorry in advance if my question may sound silly.
I created from a repeated cross-sectional dataset (11 waves) 10 groups (5 cohorts*2 genders), and I would like to add them as fixed effect in my model to show how my dependent variable (happiness) is associated with each group.
Following some literature, I prepared the dataset as following:
Then I run the analysis as follows:
The results I obtain seems quite reasonable to me, but may you confirm if this is the proper way of specifying the model?
In particular, I would like to ask you two things:
- I am interested in see how the period effect has a different effect on happiness for different groups (so to speak, imagining an interaction between n and wave, which I think is feasible in this terms), how may I specify this?
- How is it possible (if so) to define the groups also on the base of some time-varying characteristic (like education)?
Here my data
Really thanks a lot.
Cheers, Giorgio
I created from a repeated cross-sectional dataset (11 waves) 10 groups (5 cohorts*2 genders), and I would like to add them as fixed effect in my model to show how my dependent variable (happiness) is associated with each group.
Following some literature, I prepared the dataset as following:
Code:
forvalues out=1/10 { preserve collapse happi if age_male==`out', by(wave) gen n=`out' save "C:\...\col_`out'.dta", replace restore } * use "C:\...\col_1.dta", clear ... append using "C:\...\col_10.dta", replace
Code:
xtset n wave xtreg happi i.n##i.wave
In particular, I would like to ask you two things:
- I am interested in see how the period effect has a different effect on happiness for different groups (so to speak, imagining an interaction between n and wave, which I think is feasible in this terms), how may I specify this?
- How is it possible (if so) to define the groups also on the base of some time-varying characteristic (like education)?
Here my data
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(wave happi n) 1 .18431266 1 2 .08257133 1 3 .02890713 1 4 -.033792093 1 5 -.14407647 1 6 -.0515296 1 7 .10290183 1 8 .17301576 1 9 .19918926 1 10 .18477653 1 11 .05888418 1 1 .27511457 2 2 .10902543 2 3 .05344123 2 4 -.0008323822 2 5 -.10063973 2 6 -.04609436 2 7 .15427253 2 8 .1930108 2 9 .21495913 2 10 -.05401064 2 11 -.05986743 2 1 .19178474 3 2 .017143734 3 3 -.01545494 3 4 -.09630455 3 5 -.24729775 3 6 -.1621294 3 7 -.019744495 3 8 .08696201 3 9 -.025833797 3 10 .08077735 3 11 -.027652064 3 1 .2807034 4 2 .07198009 4 3 .04658693 4 4 -.06576696 4 5 -.21026304 4 6 -.14248309 4 7 .08149958 4 8 .03756344 4 9 .04044275 4 10 -.10320217 4 11 -.10965457 4 1 .1647061 5 2 -.010444737 5 3 -.0141777 5 4 -.069314145 5 5 -.2195956 5 6 -.17248316 5 7 .003739717 5 8 .03931326 5 9 -.03838405 5 10 .067745134 5 11 -.10316288 5 1 .29215783 6 2 .0893368 6 3 .09126772 6 4 -.02633409 6 5 -.12508926 6 6 -.09679314 6 7 .09746348 6 8 .05426073 6 9 .07926077 6 10 -.02303658 6 11 -.13512973 6 1 .14981456 7 2 -.010028007 7 3 -.04729141 7 4 -.12993051 7 5 -.25051603 7 6 -.2172301 7 7 -.07843793 7 8 -.011478887 7 9 -.03208165 7 10 .067713656 7 11 -.0824557 7 1 .287295 8 2 .09505638 8 3 .07974623 8 4 -.04926404 8 5 -.20598687 8 6 -.099515 8 7 .04646554 8 8 .06156417 8 9 .04429939 8 10 -.05420841 8 11 -.19584143 8 1 .16305055 9 2 .04960753 9 3 -.020350937 9 4 -.08334596 9 5 -.229174 9 6 -.1655318 9 7 -.07644808 9 8 .02687024 9 9 -.05296043 9 10 .035411663 9 11 -.02516546 9 1 .24150567 10 end
Really thanks a lot.
Cheers, Giorgio
Comment