I normally use SPSS for my statistics, however after having some issues with violations I've had to try and run a linear model in R as apparently its more robust. Someone sent me the code that I should use. The issue is I can't make heads or tails of the output!
Can anyone help me?
> mouseData <- data.frame(mouse = factor(rep(c(1:36), each = 6)),
+ shock = rep(factor(rep(c("No", "Yes"), each = 18)), 6),
+ noise = rep(factor(c(75, 105, 115)), each = 72),
+ day = rep(rep(factor(c(3, 29)), each = 36), each = 1),
+ response = c(8.05,6.45,7.55,4.8,8.2,5.05,9.55,8.9,6.05,9.55,6.5,5.25,10.2,6,4.1,5.2,8.4,3.9,8.3,14.35,8.8,11.45,11.3,6.95,14.2,10.1,5.65,6.5,7.1,7.45,6.65,6.4,4.85,7.6,7.75,6.45,5.7,12.3,8.75,5.45,10.25,5.6,7.2,13.7,6.3,5.4,4.1,6.25,6.25,5.8,7.9,4.05,6,7.75,12.2,6.3,8.3,8.9,9.3,3.1,11.95,6.6,6.35,8.4,7.65,5.4,8.5,4.35,8.85,5.55,12.3,5.2,12.05,18.55,7.8,22,12.4,8.55,8.9,13.35,21.6,12.4,16.8,9.3,11.5,14.2,12.25,12.3,16.4,15.5,19.2,17.4,9.45,11.7,11.35,11.95,11.45,8,10.4,14.4,22.3,12.3,15.5,20.8,14.2,18.6,12.2,9.9,12.65,12.85,11.65,22.7,14.2,9.55,12.15,15.4,16.2,8.6,7.5,17.4,10.4,6.45,12.85,11.7,11.1,15.85,32.8,9.8,16.4,9.2,11,15.8,32.9,18.7,30.25,13.9,52,23.6,15.85,9.7,11.7,12.15,20.7,13.2,19.7,50.9,14.75,64.85,19.55,11.5,30.75,26.4,61.9,22.55,51.95,39.65,37.6,37.7,52.1,63.4,51.6,70.9,81.95,62.95,27.65,31.15,45.05,55.7,30.8,29.6,55.1,46.2,55.05,37.1,59.2,93.55,83.55,61.75,41.85,34.45,22.45,18.1,27.45,62.85,61.5,22.9,37.9,25,80.05,28.75,39.25,26.95,57.55,43.15,20.35,43.7,25.7,31.4,95.45,67.2,37.65,34.85,28.95,89.45,56.75,16.05,139.6,20.3,106.85,46.85,106.55,46.1,44.65,22.2,23.7,24.55))
> lm(response ~ shock * noise * day, data = mouseData)
Call:
lm(formula = response ~ shock * noise * day, data = mouseData)
Coefficients:
(Intercept) shockYes noise105 noise115
6.8722 1.5639 6.7861 33.5583
day29 shockYes:noise105 shockYes:noise115 shockYes:day29
0.2806 -1.2722 9.8194 -0.9833
noise105:day29 noise115:day29 shockYes:noise105:day29 shockYes:noise115:day29
-1.2056 -3.2111 7.3833 8.0833
> mouseModel <- lm(response ~ shock * noise * day, data = mouseData)
> summary(mouseModel)
Call:
lm(formula = response ~ shock * noise * day, data = mouseData)
Residuals:
Min 1Q Median 3Q Max
-39.933 -4.190 -1.010 3.123 83.617
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.8722 3.4644 1.984 0.0486 *
shockYes 1.5639 4.8994 0.319 0.7499
noise105 6.7861 4.8994 1.385 0.1675
noise115 33.5583 4.8994 6.849 8.56e-11 ***
day29 0.2806 4.8994 0.057 0.9544
shockYes:noise105 -1.2722 6.9288 -0.184 0.8545
shockYes:noise115 9.8194 6.9288 1.417 0.1580
shockYes:day29 -0.9833 6.9288 -0.142 0.8873
noise105:day29 -1.2056 6.9288 -0.174 0.8620
noise115:day29 -3.2111 6.9288 -0.463 0.6435
shockYes:noise105:day29 7.3833 9.7988 0.753 0.4520
shockYes:noise115:day29 8.0833 9.7988 0.825 0.4104
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 14.7 on 204 degrees of freedom
Multiple R-squared: 0.6002, Adjusted R-squared: 0.5787
F-statistic: 27.84 on 11 and 204 DF, p-value: < 2.2e-16
> mouseModel2 <- aov(response ~ shock * noise * day, data = mouseData)
> summary(mouseModel2)
Df Sum Sq Mean Sq F value Pr(>F)
shock 1 2281 2281 10.558 0.00135 **
noise 2 61397 30699 142.098 < 2e-16 ***
day 1 43 43 0.200 0.65522
shock:noise 2 1973 987 4.567 0.01147 *
shock:day 1 235 235 1.088 0.29820
noise:day 2 58 29 0.133 0.87513
shock:noise:day 2 181 90 0.418 0.65906
Residuals 204 44072 216
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>