You are here

Group Exercise: Analysis of Variance (F-test)

Formulate a causal model and then identify a categorical independent variable and a numeric dependent variable. Compute the F-test and interpret the results. Paste your R code below your interpretation.

Comments

> summary(lm(V162099~V161307))

Call:
lm(formula = V162099 ~ V161307)

Residuals:
Min 1Q Median 3Q Max
-76.67 -15.18 -2.71 12.29 925.29

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 78.646 2.944 26.709 <2e-16 ***
V161307 -1.979 1.126 -1.757 0.0791 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 39.42 on 2225 degrees of freedom
(2044 observations deleted due to missingness)
Multiple R-squared: 0.001385, Adjusted R-squared: 0.0009362
F-statistic: 3.086 on 1 and 2225 DF, p-value: 0.07911

There is no evidence that social class influences favorability towards poor people

DV161095
IV 161043

> summary(lm(V161095~V161043))

Call:
lm(formula = V161095 ~ V161043)

Residuals:
Min 1Q Median 3Q Max
-53.195 -27.935 5.315 16.805 55.315

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 61.704 9.073 6.801 1.81e-08 ***
V161043 -8.510 4.711 -1.806 0.0774 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 29.01 on 46 degrees of freedom
(4223 observations deleted due to missingness)
Multiple R-squared: 0.06623, Adjusted R-squared: 0.04593
F-statistic: 3.263 on 1 and 46 DF, p-value: 0.07742

We have no evidence that their is a relationship between US House Party preference and feelings about the Democratic Party

DV161095
IV 161043

> summary(lm(V161095~V161043))

Call:
lm(formula = V161095 ~ V161043)

Residuals:
Min 1Q Median 3Q Max
-53.195 -27.935 5.315 16.805 55.315

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 61.704 9.073 6.801 1.81e-08 ***
V161043 -8.510 4.711 -1.806 0.0774 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 29.01 on 46 degrees of freedom
(4223 observations deleted due to missingness)
Multiple R-squared: 0.06623, Adjusted R-squared: 0.04593
F-statistic: 3.263 on 1 and 46 DF, p-value: 0.07742

We have no evidence that their is a relationship between US House Party preference and feelings about the Democratic Party

Call:
lm(formula = V162112 ~ frack)

Residuals:
Min 1Q Median 3Q Max
-82.62 -12.62 2.38 16.38 920.48

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 72.260 1.807 39.996 < 2e-16 ***
frack2 10.365 2.261 4.584 4.78e-06 ***
frack3 6.258 2.172 2.881 0.00399 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 41.04 on 2584 degrees of freedom
(1684 observations deleted due to missingness)
Multiple R-squared: 0.008085, Adjusted R-squared: 0.007317
F-statistic: 10.53 on 2 and 2584 DF, p-value: 2.788e-05

> summary(aov(V162112~frack))
Df Sum Sq Mean Sq F value Pr(>F)
frack 2 35472 17736 10.53 2.79e-05 ***
Residuals 2584 4352170 1684
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
1684 observations deleted due to missingness
> pairwise.t.test(V162112,frack,p.adjust.method = "bonferroni")

Pairwise comparisons using t tests with pooled SD

data: V162112 and frack

1 2
2 1.4e-05 -
3 0.012 0.072

P value adjustment method: bonferroni
> t.test(V162112[frack==1])

One Sample t-test

data: V162112[frack == 1]
t = 79.939, df = 515, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
70.48384 74.03554
sample estimates:
mean of x
72.25969

> t.test(V162112[frack==2])

One Sample t-test

data: V162112[frack == 2]
t = 71.096, df = 910, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
80.34377 84.90541
sample estimates:
mean of x
82.62459

> t.test(V162112[frack==3])

One Sample t-test

data: V162112[frack == 3]
t = 52.428, df = 1159, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
75.57891 81.45557
sample estimates:
mean of x
78.51724
We reject the null hypothesis

> lvlofed<-""; lvlofed[V161270==1]<-1;lvlofed[V161270==2]<-2;lvlofed[V161270==3]<-3;lvlofed[V161270==4]<-4
> summary(lm(V162106~lvlofed))

Call:
lm(formula = V162106 ~ lvlofed)

Residuals:
Min 1Q Median 3Q Max
-113.23 -63.23 -25.00 9.08 884.77

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 15.00 189.60 0.079 0.938
lvlofed1 35.00 268.13 0.131 0.897
lvlofed2 60.00 232.21 0.258 0.798
lvlofed3 25.92 197.34 0.131 0.897
lvlofed4 98.23 196.75 0.499 0.622

Residual standard error: 189.6 on 24 degrees of freedom
(4242 observations deleted due to missingness)
Multiple R-squared: 0.0413, Adjusted R-squared: -0.1185
F-statistic: 0.2585 on 4 and 24 DF, p-value: 0.9016

THERE IS NO EVIDENCE THAT THE MEAN OF FAVORABILITY TOWARDS MUSLIMS IS DIFFERENT FOR ALL GROUPS.

> summary(lm(V162109~V162132))

Call:
lm(formula = V162109 ~ V162132)

Residuals:
Min 1Q Median 3Q Max
-94.21 -42.49 -24.21 -5.85 941.51

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 112.58 14.53 7.750 1.81e-14 ***
V162132 -18.36 5.58 -3.291 0.00102 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 143.1 on 1332 degrees of freedom
(2937 observations deleted due to missingness)
Multiple R-squared: 0.008065, Adjusted R-squared: 0.007321
F-statistic: 10.83 on 1 and 1332 DF, p-value: 0.001025

The null hypothesis is rejected.

> pairwise.t.test(V162109,V162132,p.adjust.methods="bonferroni")

Pairwise comparisons using t tests with pooled SD

data: V162109 and V162132

1 2 3
2 0.190 - -
3 0.022 0.274 -
4 0.032 0.274 0.304

Lower class and working class no difference in favorability towards tea party, lower class and middle class have difference in favorability towards tea party, lower class and upper class have differences in favorability towards tea party.

> t.test(V162109[V162132==1])

One Sample t-test

data: V162109[V162132 == 1]
t = 4.69, df = 103, p-value = 8.416e-06
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
59.34999 146.32308
sample estimates:
mean of x
102.8365

We are 95% confident that the mean favorability towards tea party in lower class is between 59.3 and ??

> t.test(V162109[V162132==3])

One Sample t-test

data: V162109[V162132 == 3]
t = 12.151, df = 663, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
49.38350 68.42072
sample estimates:
mean of x
58.90211

We are 95% confident that favorability mean towards tea party for middle class is between 49.4 and 68.2

> t.test(V162109[V162132==4])

One Sample t-test

data: V162109[V162132 == 4]
t = 9.7811, df = 57, p-value = 8.409e-14
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
30.80995 46.67281
sample estimates:
mean of x
38.74138

We are 95% confident that favorability mean towards tea party for upper class is between 30.8 and 46.7.