Sunteți pe pagina 1din 16

1.

5625

0.74397

3.912074

sample std
mean
G1 G2 Use welsh's test
65 62
58 53 0.255381352 3.915713
78 36
60 34 0.497641712
68 56
69 50 2.378786266
66 42
70 57 0.297724472 3.35881
53 46
71 68 3.358810224
63 48
63 42
52 1.216261E-08 2.38461
53
43
6.6103683481 9.334014 0.999979332
65.3333333333 49.92857 0.000020668
F-stat 1.993818

t-Test: Two-Sample Assuming Equal Variances

Variable 1 Variable 2
Mean 49.46667 65.33333
Variance 87.12381 43.69697
Observations 15 12
Pooled Variance 68.016
Hypothesized Mean Difference 0
df 25
t Stat -4.96746
P(T<=t) one-tail 2.03E-05
t Critical one-tail 1.708141
P(T<=t) two-tail 4.05E-05
t Critical two-tail 2.059539
F-Test Two-Sample for Variances

Variable 1 Variable 2
Mean 49.46667 65.33333
Variance 87.12381 43.69697
Observatio 15 12
df 14 11
F 1.993818
P(F<=f) one0.127691
F Critical o 2.738648

P-value 0.255381
F-Test Two-Sample for Variances

Variable 1 Variable 2
Mean 65.33333 49.46667
Variance 43.69697 87.12381
Observations 12 15
df 11 14
F 0.50155
P(F<=f) one-tail 0.127691
F Critical one-tail 0.365144
Two population

G1 G2
65 62 65, 62,
58 53 65,58, 62,53,
78 36 65,58,78, 62,53,36,
60 34 65,58,78,60, 62,53,36,34,
68 56 65,58,78,60,68, 62,53,36,34,56,
69 50 65,58,78,60,68,69, 62,53,36,34,56,50,
66 42 65,58,78,60,68,69,66, 62,53,36,34,56,50,42,
70 57 65,58,78,60,68,69,66,70, 62,53,36,34,56,50,42,57,
53 46 65,58,78,60,68,69,66,70,53, 62,53,36,34,56,50,42,57,46,
71 68 65,58,78,60,68,69,66,70,53,71, 62,53,36,34,56,50,42,57,46,68,
63 48 65,58,78,60,68,69,66,70,53,71,63, 62,53,36,34,56,50,42,57,46,68,
63 42 65,58,78,60,68,69,66,70,53,71,63,63, 62,53,36,34,56,50,42,57,46,68,
52 62,53,36,34,56,50,42,57,46,68,
53 62,53,36,34,56,50,42,57,46,68,
34 43 62,53,36,34,56,50,42,57,46,68,
68
Bins
30
35
40
45
50
55
60
65
70
> m1 <- c(65,58,78,60,68,69,66,70,53,71,63,63)
> m2 <- c(62,53,36,34,56,50,42,57,46,68,48,42,52,53,43)
> qqnorm(m1)
62,53,36,34, > qqline(m1)
62,53,36,34,56, > shapiro.test(m1)
62,53,36,34,56,50, > var.test(m1,m2,ratio=1,alternative = "two.sided")
62,53,36,34,56,50,42, F test to compare two variances
62,53,36,34,56,50,42,57,
62,53,36,34,56,50,42,57,46, t.test(m1, m2, ratio=1 , alternative = "two.sided",m
62,53,36,34,56,50,42,57,46,68, + alternative = "two.sided",
62,53,36,34,56,50,42,57,46,68,48, + mu = 0, paired = FALSE)
62,53,36,34,56,50,42,57,46,68,48,42,
62,53,36,34,56,50,42,57,46,68,48,42,52,
62,53,36,34,56,50,42,57,46,68,48,42,52,53,
62,53,36,34,56,50,42,57,46,68,48,42,52,53,43,
native = "two.sided",mu = 0, paired = FALSE,conf.level = 0.90)
> ?t.test
>
>
> t.test(m1, m2, ratio=1 ,
+ alternative = "two.sided",
+ mu = 0, paired = FALSE, var.equal = FALSE,
+ conf.level = 0.95)

Welch Two Sample t-test

data: m1 and m2
t = 5.1615, df = 24.701, p-value = 2.542e-05
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
9.531687 22.201646
sample estimates:
mean of x mean of y
65.33333 49.46667

> t.test(m1, m2, ratio=1 ,


+ alternative = "two.sided",
+ mu = 0, paired = FALSE,
+ conf.level = 0.95)

Welch Two Sample t-test

data: m1 and m2
t = 5.1615, df = 24.701, p-value = 2.542e-05
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
9.531687 22.201646
sample estimates:
mean of x mean of y
65.33333 49.46667

> t.test(m1, m2, ratio=1 ,


+ alternative = "two.sided",
+ mu = 0, paired = FALSE)

Welch Two Sample t-test

data: m1 and m2
t = 5.1615, df = 24.701, p-value = 2.542e-05
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
9.531687 22.201646
sample estimates:
mean of x mean of y
65.33333 49.46667

>

> k1 <- c(23,34,35,44,46,52,28,48,28,38,33,52,41,32,37,49,50,45,29,59)


> k2 <- c(28,22,33,44,55,31,45,54,60,37,52,53,43,52,35,35,25,48,42,40)
> t.test(k1, k2, ratio=1 ,
+ + alternative = "two.sided",
Error: unexpected '=' in:
"t.test(k1, k2, ratio=1 ,
+ alternative ="
> + mu = 0, paired = FALSE, conf.level = 0.90)
Error: unexpected ',' in " + mu = 0,"
>
> t.test(m1, m2, ratio=1 , alternative = "two.sided",mu = 0, paired = FALSE,conf.level

Welch Two Sample t-test

data: m1 and m2
t = 5.1615, df = 24.701, p-value = 2.542e-05
alternative hypothesis: true difference in means is not equal to 0
90 percent confidence interval:
10.61334 21.11999
sample estimates:
mean of x mean of y
65.33333 49.46667

> t.test(k1, k2, ratio=1 , alternative = "two.sided",mu = 0, paired = FALSE,conf.level

Welch Two Sample t-test

data: k1 and k2
t = -0.47322, df = 37.7, p-value = 0.6388
alternative hypothesis: true difference in means is not equal to 0
90 percent confidence interval:
-7.073285 3.973285
sample estimates:
mean of x mean of y
40.15 41.70

> > qqnorm(k1)


Error: unexpected '>' in ">"
>
> qqnorm(k1)
> qqline(k1)
> qqnorm(k2)
> qqline(k2)
> shapiro.test(k1)

Shapiro-Wilk normality test

data: k1
W = 0.96892, p-value = 0.732

> shapiro.test(k2)

Shapiro-Wilk normality test

data: k2
W = 0.97047, p-value = 0.7647

> t.test(k1, k2, ratio=1 , alternative = "two.sided",mu = 0, paired = FALSE,conf.level

Welch Two Sample t-test

data: k1 and k2
t = -0.47322, df = 37.7, p-value = 0.6388
alternative hypothesis: true difference in means is not equal to 0
90 percent confidence interval:
-7.073285 3.973285
sample estimates:
mean of x mean of y
40.15 41.70

> var.test(k1,k2,ratio=1,alternative = "two.sided")

F test to compare two variances

data: k1 and k2
F = 0.83621, num df = 19, denom df = 19, p-value = 0.7006
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.3309815 2.1126396
sample estimates:
ratio of variances
0.83621

>

>
>

> t.test(k1, k2, ratio=1 , alternative = "two.sided",mu = 0, paired = FALSE)

Welch Two Sample t-test

data: k1 and k2
t = -0.47322, df = 37.7, p-value = 0.6388
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-8.182447 5.082447
sample estimates:
mean of x mean of y
40.15 41.70

> setwd("~/R")
>

>

>

>

>

>

> p1 <- c(19.4,16.7,16.5,20.7,19.3,17.7,21.8,16.8,16.2,14.1,17.7,17.4,16.1,19.8,16.4,1


> p2 <- c(22.4,13.8,23.7,18.7,18.0,17.4,19.3,20.8,23.2,15.6,17.1,20.1,18.0,28.2,12.3,2
> shapiro.test(p1)

Shapiro-Wilk normality test

data: p1
W = 0.96029, p-value = 0.522

> shapiro.test(p2)

Shapiro-Wilk normality test

data: p2
W = 0.97114, p-value = 0.7582

> var.test(p1,p2,ratio=1,alternative = "two.sided")

F test to compare two variances


data: p1 and p2
F = 0.17844, num df = 20, denom df = 20, p-value = 0.0003112
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.07240429 0.43976072
sample estimates:
ratio of variances
0.17844

> t.test(k1, k2, ratio=1 , alternative = "two.sided",mu = 0, paired = FALSE)

Welch Two Sample t-test

data: k1 and k2
t = -0.47322, df = 37.7, p-value = 0.6388
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-8.182447 5.082447
sample estimates:
mean of x mean of y
40.15 41.70

> t.test(p1, p2, ratio=1 , alternative = "two.sided",mu = 0, paired = FALSE)

Welch Two Sample t-test

data: p1 and p2
t = -2.1522, df = 26.917, p-value = 0.04051
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-4.5581664 -0.1085003
sample estimates:
mean of x mean of y
17.55714 19.89048

>
> ?t.test

>
aired = FALSE,conf.level = 0.90)

aired = FALSE,conf.level = 0.90)


aired = FALSE,conf.level = 0.90)
aired = FALSE)

.7,17.4,16.1,19.8,16.4,16.8,19.3,16.8,14.7,16.0,18.5)
.1,20.1,18.0,28.2,12.3,21.7,20.8,15.2,30.7,24.7,16.0)
aired = FALSE)

aired = FALSE)