Homework 6
Please note that this document completes the Stata portion. I have copied and pasted the results
from Stata into this document. To ensure that the tables and output align properly, I am using
Font: Courier (or Courier New) and Font Size: 8. Keep in mind for your homework submission, if
we cannot read the tables properly, you will not get credit.
Question 2:
ANOVA Using Real Data (30 points total)
Using the data, come up with your own research question. In other words, you will determine
which populations you would like to compare with respect to which quantitative variable. You
need to determine what is var1, the quantitative variable of interest, and what is var2, the
dichotomous variable that determines the populations you are comparing.
a.
For both variables: (1) Include a frequency table OR descriptive statistics table of the
original variable. (2) Make appropriate changes to get the variable ready for analysis
(make sure you include the commands you use to make the changes). (3) Include a
frequency table OR descriptive statistics table of the variable you will use in the
analysis (after you have made changes to it). Describe the two variables, including
which variable is var1 and which variable is var2. (10 points)
. *var1*
. tabstat V201152, s(n min max mean p50 sd)
Variable |
N
Min
Max
Mean
p50
SD
-------------+-----------------------------------------------------------V201152 |
8280
-9
100 39.05531
30 40.57108
-------------------------------------------------------------------------. recode V201152 (-9/-1=.)
(232 changes made to V201152)
. rename V201152 thermtrump
. tabstat thermtrump, s(n min max mean p50 sd)
Variable |
N
Min
Max
Mean
p50
SD
-------------+-----------------------------------------------------------thermtrump |
8048
0
100 40.44061
30 40.31091
-------------------------------------------------------------------------.
.
. *var2*
. fre V201511x
V201511x -- PRE: SUMMARY: Respondent 5 Category level of education
------------------------------------------------------------------------------------------------|
Freq.
Percent
Valid
Cum.
----------------------------------------------------+-------------------------------------------Valid
-9 -9. Refused
|
33
0.40
0.40
0.40
-8 -8. Don't know
|
1
0.01
0.01
0.41
-2 -2. Missing, other specify not coded for |
97
1.17
1.17
1.58
preliminary release
|
1 1. Less than high school credential
|
376
4.54
4.54
6.12
2 2. High school credential
|
1336
16.14
16.14
22.26
3 3. Some post-high school, no bachelor's |
2790
33.70
33.70
55.95
degree
|
4 4. Bachelor's degree
|
2055
24.82
24.82
80.77
5 5. Graduate degree
|
1592
19.23
19.23
100.00
Total
|
8280
100.00
100.00
------------------------------------------------------------------------------------------------. recode V201511x (-9 -8 -2=.) (1=0 "less than HS") (2=1 "HS degree") (3=2 "post hs but no deg") (4
> =3 "bachelor's deg'") (5=4 "grad deg"), gen(educ)
(8280 differences between V201511x and educ)
. fre educ
educ -- RECODE of V201511x (PRE: SUMMARY: Respondent 5 Category level of education)
-------------------------------------------------------------------------|
Freq.
Percent
Valid
Cum.
-----------------------------+-------------------------------------------Valid
0 less than HS
|
376
4.54
4.61
4.61
1 HS degree
|
1336
16.14
16.39
21.01
2 post hs but no deg |
2790
33.70
34.24
55.25
3 bachelor's deg'
|
2055
24.82
25.22
80.46
4 grad deg
|
1592
19.23
19.54
100.00
Total
|
8149
98.42
100.00
Missing .
|
131
1.58
Total
|
8280
100.00
-------------------------------------------------------------------------b. State the null and alternative hypothesis. (5 points)
Null: There is no difference in the average liking of trump across the 5 different education level
groups.
Alternative: There is a difference in the average liking of trump across the 5 different education level
groups.
c.
Test the null and alternative using the proper Stata command.
output (including the command). (5 points)
. oneway thermtrump educ, t
Copy and paste the Stata
RECODE of |
V201511x |
(PRE: |
SUMMARY: |
Respondent |
Summary of PRE: Feeling
5 Category |
Thermometer: Donald Trump,
level of | Republican Presidential candidate
education) |
Mean
Std. dev.
Freq.
------------+-----------------------------------less than |
46.053371
40.227521
356
HS degree |
49.906225
40.571274
1,269
post hs b |
45.860611
40.890538
2,719
bachelor' |
35.554953
38.852469
2,029
grad deg |
28.247112
36.981586
1,558
------------+-----------------------------------Total |
40.419997
40.30434
7,931
Analysis of variance
Source
SS
df
MS
F
Prob > F
-----------------------------------------------------------------------Between groups
484863.006
4
121215.751
77.50
0.0000
Within groups
12396945
7926
1564.08592
-----------------------------------------------------------------------Total
12881808
7930
1624.43985
d.
Interpret the results of the ANOVA table. Should we perform a Post-Hoc Test? Explain why
or why not. If applicable, perform a Post-Hoc test (either Bonforroni, Sidak, or
Scheffe) and copy and paste the Stata output. Interpret the results of the Post-Hoc test
in context. (10 points)
The p-value is less than 0.05, therefore, there is a difference in the average liking of trump across the
five education level groups. In order to determine which groups are different, we must perform a post-hoc
test. The following represetns the output of a bonferroni test. The output shown below shows that on
average those with at most a bachelor's degree like trump less than those with less than a bachelor's
degree (anyone with less than hs, hs degree, and post hs) (p<0.001). Furthermore, those with a graduate
degree like trump significantly less than those with less than a graduate degree (less than hs, hs degree,
post hs, and bachelor) (p<0.001). Those with post hs (but not a bachelor's degree) like trump less than
those with a hs degree (p<0.05).
. oneway thermtrump educ, b
Comparison of
PRE: Feeling Thermometer: Donald Trump, Republican Presidential candidate
by
RECODE of V201511x (PRE: SUMMARY: Respondent 5 Category level of education)
(Bonferroni)
Row Mean-|
Col Mean |
less tha
HS degre
post hs
bachelor
---------+-------------------------------------------HS degre |
3.85285
|
1.000
|
post hs |
-.19276
-4.04561
|
1.000
0.026
|
bachelor |
-10.4984
-14.3513
-10.3057
|
0.000
0.000
0.000
|
grad deg |
-17.8063
-21.6591
-17.6135
-7.30784
|
0.000
0.000
0.000
0.000