Last active
November 1, 2015 02:39
-
-
Save t-student/2c59b329cffc87f140eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm(list = ls()) | |
library(contrast) | |
taps <- c(242, 245, 244, 248, 247, 248, | |
242, 244, 246, 242, 248, 246, 245, 247, | |
248, 250, 247, 246, 243, 244, 246, 248, | |
250, 252, 248, 250, 246, 248, 245, 250) | |
group <- c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, | |
1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2) | |
df1 <- data.frame(taps, group) | |
m <- lm(taps ~ group , data = df1) | |
summary(m) | |
# Is the average finger tapping ability different between the combined 100mg and 200mg caffeine doses | |
# and the placebo (group 0), i.e. | |
# Does 0.5(mu1 + mu2) - mu0 = 0 ??? | |
contrast(m, a = list(group=c("1","2")), b=list(group="0"), type = "average") | |
# is there a difference between group 1 and 2 i.e. | |
# does mu3 - mu2 = 0 ??? | |
contrast(m, a = list(group=c("1")), b = list(group=c("2"))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment