Tuesday, August 3, 2010

R::T-TEST

> e<-c(8.5,9.48,8.65,8.16,8.83,7.76,8.63) > f<-c(8.27,8.20,8.25,8.14,9.00,8.10,7.20,8.32,7.7) > help(t.test)
> t.test(e,f,alternative="two.sided")

Welch Two Sample t-test

data: e and f
t = 1.7009, df = 12.303, p-value = 0.1141
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.1225804 1.0060725
sample estimates:
mean of x mean of y
8.572857 8.131111

> t.test(e,f,alternative="two.sided",correct=F)

Welch Two Sample t-test

data: e and f
t = 1.7009, df = 12.303, p-value = 0.1141
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.1225804 1.0060725
sample estimates:
mean of x mean of y
8.572857 8.131111


x<-c(73,77,68,62,72) > y<-c(68,72,64,62,71) > t.test(x,y,alternative=c("two.sided")
+ )

Welch Two Sample t-test

data: x and y
t = 0.9384, df = 7.478, p-value = 0.3773
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-4.462532 10.462532
sample estimates:
mean of x mean of y
70.4 67.4



y<-matrix(c(73,77,68,62,72,68,72,64,62,71)) > y
[,1]
[1,] 73
[2,] 77
[3,] 68
[4,] 62
[5,] 72
[6,] 68
[7,] 72
[8,] 64
[9,] 62
[10,] 71
> chisq.test(y,correct=F)

Chi-squared test for given probabilities

data: y
X-squared = 3.2932, df = 9, p-value = 0.9515

> t.test(y)

One Sample t-test

data: y
t = 43.3934, df = 9, p-value = 9.154e-12
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
65.30815 72.49185
sample estimates:
mean of x
68.9

No comments:

Post a Comment