-------------------------------------------------------------------------------------------------------------------------
name: <unnamed>
log: /Users/cfbaum/Desktop/polbizcycles.smcl
log type: smcl
opened on: 21 Oct 2012, 21:12:39
. // 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 {
2. assert inlist(q`i', "t", "f")
3. }
.
. // 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 {
2. tab `v'
3. }
gender | Freq. Percent Cum.
------------+-----------------------------------
F | 12 34.29 34.29
M | 23 65.71 100.00
------------+-----------------------------------
Total | 35 100.00
class | Freq. Percent Cum.
------------+-----------------------------------
2013 | 4 11.43 11.43
2014 | 29 82.86 94.29
2015 | 2 5.71 100.00
------------+-----------------------------------
Total | 35 100.00
college | Freq. Percent Cum.
------------+-----------------------------------
AS | 34 97.14 97.14
LS | 1 2.86 100.00
------------+-----------------------------------
Total | 35 100.00
party | Freq. Percent Cum.
------------+-----------------------------------
D | 4 11.76 11.76
I | 21 61.76 73.53
R | 9 26.47 100.00
------------+-----------------------------------
Total | 34 100.00
.
. // crosstab of gender and party
. tab gender party, cell nofreq
| party
gender | D I R | Total
-----------+---------------------------------+----------
F | 0.00 23.53 11.76 | 35.29
M | 11.76 38.24 14.71 | 64.71
-----------+---------------------------------+----------
Total | 11.76 61.76 26.47 | 100.00
.
. // one-way tabulations of responses for those with party affiliation
. foreach v of varlist q1-q7 {
2. qui replace `v' = strupper(`v')
3. tab `v' if !mi(party)
4. }
q1 | Freq. Percent Cum.
------------+-----------------------------------
F | 19 55.88 55.88
T | 15 44.12 100.00
------------+-----------------------------------
Total | 34 100.00
q2 | Freq. Percent Cum.
------------+-----------------------------------
F | 17 50.00 50.00
T | 17 50.00 100.00
------------+-----------------------------------
Total | 34 100.00
q3 | Freq. Percent Cum.
------------+-----------------------------------
F | 23 67.65 67.65
T | 11 32.35 100.00
------------+-----------------------------------
Total | 34 100.00
q4 | Freq. Percent Cum.
------------+-----------------------------------
F | 28 82.35 82.35
T | 6 17.65 100.00
------------+-----------------------------------
Total | 34 100.00
q5 | Freq. Percent Cum.
------------+-----------------------------------
F | 17 50.00 50.00
T | 17 50.00 100.00
------------+-----------------------------------
Total | 34 100.00
q6 | Freq. Percent Cum.
------------+-----------------------------------
F | 11 32.35 32.35
T | 23 67.65 100.00
------------+-----------------------------------
Total | 34 100.00
q7 | Freq. Percent Cum.
------------+-----------------------------------
F | 26 76.47 76.47
T | 8 23.53 100.00
------------+-----------------------------------
Total | 34 100.00
.
. // 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 {
2. qui g q`i'c = (q`i' == q`i'a) if !mi(party)
3. }
. lab val q1c-q7c correct
.
. // tabulate correct responses, by party
. forv i=1/7 {
2. di _n "#`i': `q`i'' : " q`i'a[1]
3. tab q`i'c party, cell nofreq
4. }
#1: 1929-2011 nominal stock market returns higher under Republican presidents : F
| party
q1c | D I R | Total
-----------+---------------------------------+----------
Wrong | 0.00 26.47 17.65 | 44.12
Right | 11.76 35.29 8.82 | 55.88
-----------+---------------------------------+----------
Total | 11.76 61.76 26.47 | 100.00
#2: 1929-2011 real stock market returns higher under Democratic presidents : T
| party
q2c | D I R | Total
-----------+---------------------------------+----------
Wrong | 5.88 26.47 17.65 | 50.00
Right | 5.88 35.29 8.82 | 50.00
-----------+---------------------------------+----------
Total | 11.76 61.76 26.47 | 100.00
#3: 1929-2011 bond market returns negative under Republican presidents : F
| party
q3c | D I R | Total
-----------+---------------------------------+----------
Wrong | 5.88 14.71 11.76 | 32.35
Right | 5.88 47.06 14.71 | 67.65
-----------+---------------------------------+----------
Total | 11.76 61.76 26.47 | 100.00
#4: 1929-2011 bond market returns negative under Democratic presidents : T
| party
q4c | D I R | Total
-----------+---------------------------------+----------
Wrong | 11.76 55.88 14.71 | 82.35
Right | 0.00 5.88 11.76 | 17.65
-----------+---------------------------------+----------
Total | 11.76 61.76 26.47 | 100.00
#5: 1929-2011 inflation twice as high under Democratic than under Republican presidents : F
| party
q5c | D I R | Total
-----------+---------------------------------+----------
Wrong | 5.88 23.53 20.59 | 50.00
Right | 5.88 38.24 5.88 | 50.00
-----------+---------------------------------+----------
Total | 11.76 61.76 26.47 | 100.00
#6: 1952-2004 after-tax income gain for top 20% higher under Republican presidents : F
| party
q6c | D I R | Total
-----------+---------------------------------+----------
Wrong | 2.94 44.12 20.59 | 67.65
Right | 8.82 17.65 5.88 | 32.35
-----------+---------------------------------+----------
Total | 11.76 61.76 26.47 | 100.00
#7: 1952-2004 after-tax income gain for bottom 20% negative under Republican presidents : T
| party
q7c | D I R | Total
-----------+---------------------------------+----------
Wrong | 8.82 44.12 23.53 | 76.47
Right | 2.94 17.65 2.94 | 23.53
-----------+---------------------------------+----------
Total | 11.76 61.76 26.47 | 100.00
.
. // produce score, tabulate vs gender and party
. qui egen pctright = rowtotal(q1c-q7c) if !mi(party)
. qui replace pctright = 100 * pctright / 7
. su pctright
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
pctright | 34 42.43698 14.27935 14.28571 71.42857
. tabstat pctright, by(gender) stat(mean min max N) format(%6.2f)
Summary for variables: pctright
by categories of: gender
gender | mean min max N
-------+----------------------------------------
F | 47.62 14.29 71.43 12.00
M | 39.61 14.29 57.14 22.00
-------+----------------------------------------
Total | 42.44 14.29 71.43 34.00
------------------------------------------------
. tabstat pctright, by(party) stat(mean min max N) format(%6.2f)
Summary for variables: pctright
by categories of: party
party | mean min max N
-------+----------------------------------------
D | 50.00 42.86 57.14 4.00
I | 45.58 28.57 71.43 21.00
R | 31.75 14.29 42.86 9.00
-------+----------------------------------------
Total | 42.44 14.29 71.43 34.00
------------------------------------------------
.
. /*
>
> 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
Source | SS df MS Number of obs = 34
-------------+------------------------------ F( 3, 30) = 5.38
Model | 2352.67573 3 784.225242 Prob > F = 0.0044
Residual | 4376.01613 30 145.867204 R-squared = 0.3496
-------------+------------------------------ Adj R-squared = 0.2846
Total | 6728.69186 33 203.899753 Root MSE = 12.078
------------------------------------------------------------------------------
pctright | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
2.igender | -11.12516 4.508996 -2.47 0.020 -20.33376 -1.91656
|
iparty |
2 | -8.659924 6.809067 -1.27 0.213 -22.56589 5.246046
3 | -23.19848 7.529295 -3.08 0.004 -38.57535 -7.821612
|
_cons | 61.12516 7.536435 8.11 0.000 45.73371 76.51661
------------------------------------------------------------------------------
. margins i.igender i.iparty
Predictive margins Number of obs = 34
Model VCE : OLS
Expression : Linear prediction, predict()
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
igender |
1 | 49.63561 3.578061 13.87 0.000 42.62274 56.64848
2 | 38.51045 2.612049 14.74 0.000 33.39093 43.62997
|
iparty |
1 | 53.92653 6.244949 8.64 0.000 41.68665 66.1664
2 | 45.2666 2.638562 17.16 0.000 40.09512 50.43809
3 | 30.72804 4.046937 7.59 0.000 22.79619 38.65989
------------------------------------------------------------------------------
. testparm i.igender
( 1) 2.igender = 0
F( 1, 30) = 6.09
Prob > F = 0.0195
. testparm i.iparty
( 1) 2.iparty = 0
( 2) 3.iparty = 0
F( 2, 30) = 6.36
Prob > F = 0.0050
.
. /* Both gender and self-identified party affiliation have significant effects
> on the individual's score.
> */
.
. log close
name: <unnamed>
log: /Users/cfbaum/Desktop/polbizcycles.smcl
log type: smcl
closed on: 21 Oct 2012, 21:12:39
-------------------------------------------------------------------------------------------------------------------------