I am trying to draw a scatter plot of two variables, after having taken into account fixed effects (state and year). The idea is to analyse the correlation between gonorrhea rates and broadband diffusion so that I ran the following regression
Then I collected the residuals using
and I plot the residuals against broadband by state running
Is this the right way to proceed? I tried to follow some other sources but I am not 100% sure about the code I wrote here.
Code:
tsset state year xtreg gonorrhea internet i.year, fe
Code:
predict gonorrhea_res, e
Code:
scatter internet gonorrhea_res, by(state)
Comment