*GABARITO - LAB3 *First, run all these commands: qui reg consumption income est sto pop *Sample A: n=10 use "gujarti", clear set seed 1245 sample 10, count qui reg consumption income est sto s1 *Sample B: n=10 use "gujarti", clear set seed 1234 sample 10, count qui reg consumption income est sto s2 *Sample C: n=30 use "gujarti", clear set seed 1245 sample 30, count qui reg consumption income est sto s3 *Sample D: n=30 use "gujarti", clear set seed 1234 sample 30, count qui reg consumption income est sto s4 *Strata use "gujarti", clear gsample 10, percent strata(income) qui reg consumption income est sto s5 **ANSWERS: *1) // Look at regression tables with confidence intervals esttab pop s1 s2 s3 s4, ci // Now let's compare the coefficient plots: *ssc install coefplot coefplot pop || s1 || s2 || s3 || s4, xline(.6002891) drop(_cons) byopts(col(1)) // with n=30, .6002891 is the pop regression beta for income *2) esttab pop s1 s5, ci coefplot pop || s1 || s5, xline(.6002891) drop(_cons) byopts(col(1)) *3) //example of one possible answer use "gujarti", clear expand 3 if income == 80 expand 2 if income == 100 expand 1 if income == 120 //kdensity kdensity income //scatter scatter income consumption //regress reg consumption income eststo s6 //esttab esttab pop s2 s6, ci //coefficient plot coefplot pop || s3 || s6, xline(.6002891) drop(_cons) byopts(row(1))