************************************ ************************************ ***INTRODUCTION TO INFERENTIAL STATISTICS (chapter 6) ***ESTIMATION PROCEDURES (chapter 7) ************************************ ************************************ ************************************ ***OPENING COMMANDS ************************************ ***Clear memory clear all ***Start saving results window log using "C:\course\progs\Stata06-07.log", replace text // Windows log using "/course/progs/Stata06-07.log", replace text // Macintosh ***Open 2016 GSS use "C:\course\data\GSS2016.dta", clear // Windows use "/course/data/GSS2016.dta", clear // Macintosh ***Complex survey design svyset [weight=wtssall], strata(vstrat) psu(vpsu) singleunit(scaled) ************************************ ***CONFIDENCE INTERVAL FOR MEANS ************************************ ************************************ ***Respondent income in constant dollars (conrinc) ************************************ ***No weight sum conrinc, d mean conrinc estat sd ***Weight ***It corrects the mean sum conrinc [aweight=wtssall], d mean conrinc [aweight=wtssall] ***Survey design ***It corrects the mean and standard error svy: mean conrinc estat sd ************************************ ***Different confidence levels ************************************ ***90% confidence level svy: mean conrinc, level(90) ***95% confidence level svy: mean conrinc ***99% confidence level svy: mean conrinc, level(99) ************************************ ***CONFIDENCE INTERVAL FOR PROPORTIONS ************************************ ************************************ ***Opinion about how should the number ***of immigrants to America be nowadays ************************************ ***Frequency distribution tab letin1 [aweight=wtssall] ***No weight prop letin1 ***Weight ***It corrects the mean ***aweights not allowed prop letin1 [iweight=wtssall] ***Survey design ***It corrects the mean and standard error svy: prop letin1 ************************************ ***Different confidence levels ************************************ ***90% confidence level svy: prop letin1, level(90) ***95% confidence level svy: prop letin1 ***99% confidence level svy: prop letin1, level(99) ************************************ ***CLOSING COMMANDS ************************************ ***Save data save "Stata06-07.dta", replace ***Save log log close