************************************ ************************************ ***HYPOTHESIS TESTING I: THE ONE-SAMPLE CASE (chapter 8) ************************************ ************************************ ************************************ ***OPENING COMMANDS ************************************ ***Clear memory clear all ***Start saving results window log using "C:\course\progs\Stata08.log", replace text // Windows log using "/course/progs/Stata08.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) ************************************ ***ONE-SAMPLE Z-TEST AND t-TEST ************************************ ***Personal income ***of sample of adult population (18+) ***compared to population 15+ (U.S. Census Bureau) ***https://fred.stlouisfed.org/series/MEPAINUSA672N ***Mean personal income svy: mean conrinc mean conrinc ***Z-test ztest conrinc=31099 ***t-test ttest conrinc=31099 ************************************ ***ONE-SAMPLE TEST OF PROPORTIONS ************************************ ***Gender composition ***of sample of adult population (18+) ***compared to overall population (U.S. Census Bureau) ***https://www.census.gov/quickfacts/fact/table/US/PST045216 ***Generate dummy variable for female tab sex tab sex, nolabel generate female=. replace female=0 if sex==1 replace female=1 if sex==2 tab sex female, m tab female ***Proportion test prtest female=.508 ************************************ ***CLOSING COMMANDS ************************************ ***Save data save "Stata08.dta", replace ***Save log log close