************************************ ************************************ ***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\Stata04.log", replace text // Windows log using "/course/progs/Stata04.log", replace text // Macintosh ***Open 2016 GSS use "C:\course\data\GSS2016.dta", clear // Windows use "/course/data/GSS2016.dta", clear // Macintosh ************************************ ***SURVEY DESIGN ************************************ ***First-stage unit ***VSTRAT: Variance Stratum ***National Frame Areas (NFAs): one or more counties ***Second-stage unit ***VPSU: Variance Primary Sampling Unit ***Segments: block, group of blocks, or census tract ***singleunit(scaled) ***The scaling factor comes from using ***the average of the variances from the strata with multiple sampling units ***for each stratum with one sampling unit svyset [weight=wtssall], strata(vstrat) psu(vpsu) singleunit(scaled) ************************************ ***CONFIDENCE INTERVAL FOR MEANS ************************************ ************************************ ***Respondent income in constant dollars (conrinc) ************************************ ***No weight mean conrinc ***Weight ***It corrects the mean mean conrinc [aweight=wtssall] ***Survey design ***It corrects the mean and standard error svy: mean conrinc ************************************ ***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 log log close