Created
May 23, 2012 12:05
-
-
Save am0c/2774860 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
am0c@amolap:~/tmp/stat$ cat section-3.R | |
resist <- data.frame( | |
case = c( | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
1, 1, 1, 1, 1 | |
), | |
val = c( | |
55.2, 53.5, 52.3, 54.1, 52.4, 50.5, 53.5, 46.9, 52.9, 57.1, | |
55.7, 51.2, 55.2, 57.4, 53.9, 58.1, 50.6, 59.4, 51.8, 50.8, | |
56.9, 56.3, 59.1, 52.7, 56.1, 58.2, 53.1, 50.6, 53.1, 59.7, | |
46.9, 50.6, 47.3, 48.0, 49.2, 48.4, 48.5, 48.6, 48.2, 50.2, | |
47.2, 50.3, 49.1, 48.2, 47.4, 48.1, 49.4, 47.4, 49.7, 49.1, | |
49.3, 50.3, 50.8, 48.3, 47.7, 48.5, 51.1, 50.9, 49.5, 49.7, | |
51.4, 48.1, 49.7, 50.9, 48.6) | |
) | |
sink("section-rout-3.txt"); | |
ret <- var.test(resist$val[resist$case == 0], resist$val[resist$case == 1], | |
alternative = c("two.sided")) | |
print(ret) | |
ret <- t.test(resist$val[resist$case == 0], resist$val[resist$case == 1], | |
alternative = c("two.sided"), mu = 0, var.equal = FALSE) | |
print(ret) | |
am0c@amolap:~/tmp/stat$ r section-3.R | |
am0c@amolap:~/tmp/stat$ cat section-rout-3.txt | |
F test to compare two variances | |
data: resist$val[resist$case == 0] and resist$val[resist$case == 1] | |
F = 6.297, num df = 29, denom df = 34, p-value = 8.821e-07 | |
alternative hypothesis: true ratio of variances is not equal to 1 | |
95 percent confidence interval: | |
3.116279 12.986046 | |
sample estimates: | |
ratio of variances | |
6.296998 | |
Welch Two Sample t-test | |
data: resist$val[resist$case == 0] and resist$val[resist$case == 1] | |
t = 8.5887, df = 36.85, p-value = 2.527e-10 | |
alternative hypothesis: true difference in means is not equal to 0 | |
95 percent confidence interval: | |
3.996731 6.465173 | |
sample estimates: | |
mean of x mean of y | |
54.27667 49.04571 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment