set more off capt log close log using polbizcycles, replace // EC 228 01 F2012 Political Business Cycles questionnaire use polbizcycles, clear // validate the hand-entered data assert inlist(gender, "m", "f") assert inlist(class, 13, 14, 15) assert inlist(college, "as", "cs", "ls") assert inlist(party, "d", "r", "i") | mi(party) forv i=1/7 { assert inlist(q`i', "t", "f") } // clean up variables qui replace gender = strupper(gender) qui replace class = class + 2000 qui replace college = strupper(college) qui replace party = strupper(party) // one-way tabulations foreach v of varlist gender class college party { tab `v' } // crosstab of gender and party tab gender party, cell nofreq // one-way tabulations of responses for those with party affiliation foreach v of varlist q1-q7 { qui replace `v' = strupper(`v') tab `v' if !mi(party) } // correct responses to each question from Economist article g q1a = "F" g q2a = "T" g q3a = "F" g q4a = "T" g q5a = "F" g q6a = "F" g q7a = "T" loc q1 "1929-2011 nominal stock market returns higher under Republican presidents" loc q2 "1929-2011 real stock market returns higher under Democratic presidents" loc q3 "1929-2011 bond market returns negative under Republican presidents" loc q4 "1929-2011 bond market returns negative under Democratic presidents" loc q5 "1929-2011 inflation twice as high under Democratic than under Republican presidents" loc q6 "1952-2004 after-tax income gain for top 20% higher under Republican presidents" loc q7 "1952-2004 after-tax income gain for bottom 20% negative under Republican presidents" // flag correct answers lab def correct 0 Wrong 1 Right forv i=1/7 { qui g q`i'c = (q`i' == q`i'a) if !mi(party) } lab val q1c-q7c correct // tabulate correct responses, by party forv i=1/7 { di _n "#`i': `q`i'' : " q`i'a[1] tab q`i'c party, cell nofreq } // produce score, tabulate vs gender and party qui egen pctright = rowtotal(q1c-q7c) if !mi(party) qui replace pctright = 100 * pctright / 7 su pctright tabstat pctright, by(gender) stat(mean min max N) format(%6.2f) tabstat pctright, by(party) stat(mean min max N) format(%6.2f) /* Summary demographics: 35 of 47 enrolled responded: 12 women and 23 men. 29 of 35 are juniors; 4 are seniors and 2 are sophomores. 34 of 35 are A&S students, while one is a LSOE student. 21 of 35 (74%) self-identify as Independents; 4 as Democrats, 9 as Republicans. All of those identifying as Democrats are males. Q1: "1929-2011 nominal stock market returns higher under Republican presidents" The statement is FALSE. 19 of 34 (56%) expressing a party affiliation were correct. Q2: "1929-2011 real stock market returns higher under Democratic presidents" The statement is TRUE. 17 of 34 (50%) were correct. Q3: "1929-2011 bond market returns negative under Republican presidents" The statement is FALSE. 23 of 34 (68%) were correct. Q4: "1929-2011 bond market returns negative under Democratic presidents" The statement is TRUE. 6 of 34 (18%) were correct. Q5: "1929-2011 inflation twice as high under Democratic than under Republican presidents" The statement is FALSE. 17 of 34 (50%) were correct. Q6: "1952-2004 after-tax income gain for top 20% higher under Republican presidents" The statement is FALSE. 11 of 34 (32%) were correct. Q7: "1952-2004 after-tax income gain for bottom 20% negative under Republican presidents" The statement is TRUE. 8 of 34 (24%) were correct. 34 respondents had a mean score of 42.3 / 100, ranging from 14 to 71. 12 Females had a mean score of 47.6, ranging from 14 to 71. 22 Males had a mean score of 39.6, ranging from 14 to 57. 4 Democrats had a mean score of 50.0, ranging from 42.9 to 57.1. 9 Republicans had a mean score of 31.75, ranging from 14.3 to 42.9. 21 Independents had a mean score of 45.6, ranging from 28.6 to 71.4. */ encode party,gen(iparty) encode gender, gen(igender) reg pctright i.igender i.iparty margins i.igender i.iparty testparm i.igender testparm i.iparty /* Both gender and self-identified party affiliation have significant effects on the individual's score. */ log close log2html polbizcycles, replace translate polbizcycles.smcl polbizcycles.pdf, replace