Sei sulla pagina 1di 8

PROBLEM 1

data=read.table("e://qtn1.txt",header=T)
attach(data)
data
sample
1 49.95243
2 49.27871
3 52.33316
4 49.49804
5 50.69350
6 50.28330
7 49.57799
8 52.88352
9 50.42930
10 50.07159
11 53.40532
12 52.12972
13 50.10087
14 49.87355
15 51.34625
16 48.14747
17 46.98792
18 47.91650
19 52.33144
20 48.51336
21 48.98135
22 49.73412
23 52.82960
24 49.63990
25 48.90297
26 49.33822
27 48.74059
28 51.00985
29 49.35953
30 49.06091
31 48.70057
32 48.79921
33 50.48745
34 46.08142
35 52.54544
36 46.45470
37 49.18395
38 49.24865
39 51.81087
40 52.18749

41 48.14416
42 48.14141
43 44.87788
44 49.20987
45 49.77687
46 50.77116
47 53.78734
48 49.17452
49 49.61924
50 44.84340
t.test(sample,mu=45)
One Sample t-test
data: sample
t = 16.9171, df = 49, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 45
95 percent confidence interval:
49.18040 50.30746
sample estimates:
mean of x
49.74393
PROBLEM 2
data=read.table("e://qtn2.txt",header=T)
attach(data)
data
sample1 sample2
1 69.53202 69.90485
2 71.61519 68.55743
3 74.23775 74.66631
4 76.94839 68.99608
5 67.92586 71.38700
6 74.67134 70.56659
7 72.23039 69.15599
8 69.18270 75.76704
9 75.01163 70.85860
10 68.09631 70.14319
11 66.04805 76.81065
12 72.51174 74.25944
13 74.27253 70.20175
14 72.28380 69.74710
15 67.35411 72.69251
16 65.85377 66.29495

17 68.67429 63.97583
18 71.39106 65.83300
19 74.20450 74.66288
20 73.18133 67.02672
21 70.33656 67.96270
22 64.87301 69.46825
23 68.68819 75.65919
24 71.71114 69.27980
25 67.57888 67.80595
26 74.29226 68.67645
27 67.93907 67.48117
28 71.77439 72.01971
29 63.97880 68.71905
30 66.11375 68.12182
31 70.37563 67.40114
32 73.32824 67.59842
33 73.59058 70.97490
34 71.78773 62.16284
35 72.99316 75.09089
36 68.04238 62.90941
37 70.04507 68.36789
38 68.54516 68.49731
39 67.07149 73.62174
40 69.06677 74.37498
41 69.72415 66.28832
42 70.96274 66.28282
43 69.65783 59.75576
44 73.49873 68.41974
45 73.75939 69.55375
46 72.72119 71.54231
47 76.23802 77.57468
48 69.66247 68.34903
49 72.16903 69.23848
50 72.21690 59.68681
> t.test(sample1,sample2,mu1=mu2)
Welch Two Sample t-test
data: sample1 and sample2
t = 1.8006, df = 91.726, p-value = 0.07505
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.1310438 2.6740932
sample estimates:
mean of x mean of y
70.75939 69.48786

var.test(sample1,sample2)
F test to compare two variances
data: sample1 and sample2
F = 0.5854, num df = 49, denom df = 49, p-value = 0.06377
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.3321887 1.0315484
sample estimates:
ratio of variances
0.5853792
PROBLEM 3
wk1=c(67,24,57,55,63,54,56,68,33,43)
wk2=c(70,38,58,58,56,67,68,72,42,38)
t.test(wk1,wk2,paired=T,mu=0)
Paired t-test
data: wk1 and wk2
t = -2.0392, df = 9, p-value = 0.07186
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-9.9138783 0.5138783
sample estimates:
mean of the differences
-4.7
PROBLEM 4
x=c(63,65,68,69,71,72)
y=c(61,62,65,66,69,70,71,72,73)
t.test(x,y,alternative="greater")
Welch Two Sample t-test
data: x and y
t = 0.1644, df = 12.454, p-value = 0.436
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
-3.269467
Inf
sample estimates:
mean of x mean of y

68.00000 67.66667
PROBLEM 5
1437-432
[1] 1005
441-152
[1] 289
x=c(432,1005,152,289)
data=matrix(x,ncol=2,nrow=2)
data
[,1] [,2]
[1,] 432 152
[2,] 1005 289
chisq.test(data)
Pearson's Chi-squared test with Yates' continuity correction
data: data
X-squared = 2.8531, df = 1, p-value = 0.0912
PROBLEM 6
data=read.table("e://qtn6.txt",header=T)
attach(data)
data
nr
1 0.464
2 0.906
3 -0.482
4 -1.787
5 0.137
6 -0.513
7 1.678
8 -0.261
9 2.455
10 -0.525
11 -0.527
12 1.237
13 -0.323
14 0.595
15 -1.229
16 1.046
17 -0.068
18 0.881

19 -0.486
20 -0.508
ks.test(nr,pnorm,0,1)
One-sample Kolmogorov-Smirnov test
data: nr
D = 0.1991, p-value = 0.358
alternative hypothesis: two-sided

PROBLEM 7
x=c(40,30,40,45,55,30)
y=c(50,50,45,55,60,40)
ks.test(x,y)
Two-sample Kolmogorov-Smirnov test
data: x and y
D = 0.5, p-value = 0.4413
alternative hypothesis: two-sided
Warning message:
In ks.test(x, y) : cannot compute exact p-values with ties
PROBLEM 9
data=read.table("e://qtn9.txt",header=T)
attach(data)
data
sample1
sample2
1 5.4200826 5.9463165
2 0.8113748 -0.3387086
3 2.7234520 1.6419584
4 4.5077716 3.0440167
5 4.2080279 4.2694326
6 4.1133686 1.6988516
7 3.9022155 3.3151449
8 6.0182569 3.1456180
9 5.8337415 6.4646622
10 4.0404660 0.9577660
11 1.1563841 1.9411447

12 2.1793022 4.0401532
13 5.2900998 4.1346655
14 0.6373862 5.1839670
15 6.9539595 6.4064778
16 5.1840424 4.4070035
17 1.4481271 3.3922598
18 2.0790522 3.6231598
19 3.3614098 3.6938375
20 7.3406547 5.4209754
var.test(sample1,sample2)
F test to compare two variances
data: sample1 and sample2
F = 1.2427, num df = 19, denom df = 19, p-value = 0.6405
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.4918769 3.1396280
sample estimates:
PROBLEM 10
x=c(24,27,26,21,25)
y=c(27,30,28,31,22,36)
t.test(x,y,mu1=mu2)
Welch Two Sample t-test
data: x and y
t = -2.0383, df = 7.559, p-value = 0.07794
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-9.4290144 0.6290144
sample estimates:
mean of x mean of y
24.6 29.0
var.test(x,y)
F test to compare two variances
data: x and y
F = 0.2454, num df = 4, denom df = 5, p-value = 0.1981
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.03321253 2.29776367

sample estimates:
ratio of variances
0.2453704

Potrebbero piacerti anche