****** Issues of Independence ********************************************* * 1. cluster s.e. ********************************************* * Eurobarometer dataset: "satisfaction with democracy.dta" tab demo_satisf * actually not a great idea to use a OLS with such type of DV (!!!), but let's do that as an example tab id mean demo_satisf, over(id) graph bar demo_satisf, over(id, sort(1)) sort id by id: egen sd_demo = sd(demo_satisf) graph bar sd_demo, over(id, sort(1)) graph bar demo_satisf sd_demo, over(id, sort(1)) reg demo_satisf life_satisf exp_eco exp_employ tv_use newspapers radio_use reg demo_satisf life_satisf exp_eco exp_employ tv_use newspapers radio_use, r reg demo_satisf life_satisf exp_eco exp_employ tv_use newspapers radio_use, cluster(id) ********************************************* * 2. fixed effects ********************************************* xi: reg demo_satisf life_satisf exp_eco exp_employ tv_use newspapers radio_use i.id testparm _Iid* areg demo_satisf life_satisf exp_eco exp_employ tv_use newspapers radio_use, abs(id) char id [omit] 2 xi: reg demo_satisf life_satisf exp_eco exp_employ tv_use newspapers radio_use i.id * Happiness dataset: "happiness.dta" reg sodlife self health age sex sodfin religion_attendance trust marriage child post_mat4 xi: reg sodlife self health age sex sodfin religion_attendance trust marriage child post_mat4, i(country_anno) encode country_anno, gen (code) tab code xi: reg sodlife self health age sex sodfin religion_attendance trust marriage child post_mat4 i.code testparm _Icode* areg sodlife self health age sex sodfin religion_attendance trust marriage child post_mat4, absorb(code) * adding country-level covariates? you cannot! areg sodlife gdpgrowth_avg self health age sex sodfin religion_attendance trust marriage child post_mat4, absorb(code) xi: reg sodlife gdpgrowth_avg self health age sex sodfin religion_attendance trust marriage child post_mat4 i.code * of course you can still test you non-linear hypothesis xi: reg sodlife c.self##c.self sex health sodfin religion_attendance trust marriage child post_mat4 i.code margins, at(self=(0 (1) 9)) marginsplot margins, dydx(self) at(self=(0 (1) 9)) marginsplot, yline(0) xi: reg sodlife self c.age##c.health sex sodfin religion_attendance trust marriage child post_mat4 i.code