Вы находитесь на странице: 1из 8

BIOSTATISTICS - BIOL 2163

PRACTICAL - LAB #3 EXAMPLE

INSTRUCTIONS: Please use R for questions 1 5.

CONFIDENCE INTERVALS AND HYPOTHESIS TESTING: SINGLE SAMPLE


1. A pre-med student in a statistics class is required to do a class project. She plans to collect her
own sample data to test the claim that the mean body temperature is less than 98.6F. After
carefully planning a procedure for obtaining a simple random sample of 12 healthy adults, she
measures their body temperatures and obtains the results listed below. Use a 0.05 significance level
to test the claim these body temperatures come from a population with a mean that is less than
98.6F. Find a 95% confidence interval for the mean body temperatures.
98.0, 97.5, 98.6, 98.8, 98.0, 98.5, 98.6, 99.4, 98.4, 98.7, 98.6, 97.6

SOLUTION:
(From R)
> x<-c( 98.0, 97.5, 98.6, 98.8, 98.0, 98.5, 98.6, 99.4, 98.4, 98.7, 98.6, 97.6)
> t.test(x,alternative="less",mu=98.6,conf.level=0.95)
One Sample t-test
data: x
t = -1.3488, df = 11, p-value = 0.1023
alternative hypothesis: true mean is less than 98.6
95 percent confidence interval:
-Inf 98.66906
sample estimates:
mean of x
98.39167
> mean(x)
[1] 98.39167
> sd(x)
[1] 0.5350588
> cilower <- 98.39166667 - qt(0.95,df=11) * (0.5350588/sqrt(12))
> cilower
[1] 98.11428

> ciupper <- 98.39166667 + qt(0.95,df=11) * (0.5350588/sqrt(12))


> ciupper
[1] 98.66906
Analysis:
The 95% confidence interval is (98.11428, 98.66906).
Hypothesis Testing:
0 : = 98.6
1 : < 98.6
= 0.05
Test Statistic: t = -1.3488
Critical value: = 1.796 (from t-distribution tables)
Decision: Since the test statistic t = -1.3488 > -1.796, we fail to reject 0 .

2. The Carolina Tobacco company advertised that its best-selling non filtered cigarettes contain at
most 40 mg of nicotine, but Consumer Advocate magazine ran tests of 10 randomly selected
cigarettes and found the amounts (in mg) shown below. It's a serious matter to charge that the
company advertising is wrong, so the magazine editor chooses a significance level of 0.05 in testing
her belief that the mean nicotine content is greater than 40 mg. Perform this test to determine if the
mean is greater than 40 mg. Also, find a 95% confidence interval for the mean nicotine content.
47.3, 39.3, 40.3, 38.3, 46.3, 43.3, 42.3, 49.3, 46.3, 40.3

SOLUTION:
(From R)
> x<-c(47.3, 39.3, 40.3, 38.3, 46.3, 43.3, 42.3, 49.3, 46.3, 40.3)
> t.test(x,alternative="greater",mu=40,conf.level=0.95)
One Sample t-test
data: x
t = 2.7458, df = 9, p-value = 0.01132
alternative hypothesis: true mean is greater than 40
95 percent confidence interval:
41.09687
Inf

sample estimates:
mean of x
43.3
> mean(x)
[1] 43.3
> sd(x)
[1] 3.800585
> cilower <- 43.3 - qt(0.95,df=9) * (3.800585/sqrt(10))
> cilower
[1] 41.09687
> ciupper <- 43.3 + qt(0.95,df=9) * (3.800585/sqrt(10))
> ciupper
[1] 45.50313
Analysis:
The 95% confidence interval is (41.09687, 45.50313).
Hypothesis Testing:
0 : = 40
1 : > 40
= 0.05
Test Statistic: t = 2.7458
Critical value: = 1.833 (from t-distribution tables)
Decision: Since the test statistic t = 2.7458 > 1.833, we reject 0 .

3. A random sample of 22 fifth grade pupils have a mean grade point average of 5.0 in Math,
where marks range from 1 (worst) to 6 (excellent). The mean grade point average (GPA) of all
fifth grade pupils of the last five years is 4.7 (GPA of the population). Is the mean GPA of the 22
pupils different from the mean GPA of the population? Use a significance level of = 0.05 to
test the claim that the mean GPA of the 22 pupils is different from the mean GPA of the
population. Assume is not known. Also, find a 95% confidence interval for the GPA of the
population.
0 : = 4.7
1 : 4.7
5
4.5

5.5
4.5

4.5
5.5

5
4

5
5

6
5

5
5.5

5
4.5

4.5
5.5

5
5

5
5.5

SOLUTION:
(From R)
> x<-c(5,5.5,4.5,5,5,6,5,5,4.5,5,5,4.5,4.5,5.5,4,5,5,5.5,4.5,5.5,5,5.5)
> t.test(x,alternative="two.sided",mu=4.7,conf.level=0.95)
One Sample t-test
data: x
t = 3.0397, df = 21, p-value = 0.006229
alternative hypothesis: true mean is not equal to 4.7
95 percent confidence interval:
4.794757 5.205243
sample estimates:
mean of x
5
Analysis:
The 95% confidence interval is (4.794757, 5.205243).
Hypothesis Testing:
0 : = 4.7
1 : 4.7
= 0.05
Test Statistic: t = 3.0397
Critical value: = 2.080(from t-distribution tables)
Decision: Since the test statistic t = 3.0397 > 2.080, we reject 0 .

CONFIDENCE INTERVALS AND HYPOTHESIS TESTING: INDEPENDENT SAMPLES


4. Leaves were collected from wax-leaf ligustrum that were grown in the shade and in the full sun.
The thickness in micrometers of the palisade layer was recorded for each type of leaf. The
thicknesses of 7 sun leaves were reported as: 150, 100, 210, 300, 200, 210, and 300 and the
thicknesses of 7 shade leaves were reported as 120, 125, 160, 130, 200, 170, and 200. Using a 0.05
significance level, test the claim that the thickness of the palisade layer differs between the sun
leaves and the shade leaves. Assume equal variances. Also, find a 95% confidence interval for the
mean difference in thickness between the sun leaves and the shade leaves.

0 : 1 = 2
1 : 1 2
SOLUTION:
(From R)
> x<- c(150,100,210,300,200,210,300)
> y <- c(120,125,160,130,200,170,200)
> t.test(x,y,alternative="two.sided",var.equal=TRUE)
Two Sample t-test
data: x and y
t = 1.7113, df = 12, p-value = 0.1127
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-14.24487 118.53059
sample estimates:
mean of x mean of y
210.0000 157.8571
Analysis:
The 95% confidence interval is (14.24487, 118.53059).
Hypothesis Testing:
0 : 1 = 2
1 : 1 2
= 0.05
Test Statistic: t = 1.7113
Critical value: = 2.179(from t-distribution tables)
Decision: Since the test statistic t = 1.7113 < 2.179, we fail to reject 0 .

5. Refer to the datasets on BMI and test the claim that the mean body mass index (BMI) of men is
equal to the mean BMI of women. Also, construct a 95% confidence interval estimate of the
difference between the mean BMI of men and the mean BMI of women.
0 : 1 = 2
1 : 1 2

SOLUTION:
(From R)
> men<-read.table("MBMI.txt")
> men
V1
1 23.8
2 23.2
3 24.6
4 26.2
5 23.5
6 24.5
7 21.5
8 31.4
9 26.4
10 22.7
11 27.8
12 28.1
13 25.2
14 23.3
15 31.9
16 33.1
17 33.2
18 26.7
19 26.6
20 19.9
21 27.1
22 23.4
23 27.0
24 21.6
25 30.9
26 28.3
27 25.5
28 24.6
29 23.8
30 27.4
31 28.7
32 26.2
33 26.4
34 32.1
35 19.6
36 20.7
37 26.3
38 26.9
39 25.6

40 24.2
> women<-read.table("FBMI.txt")
> women
V1
1 19.6
2 23.8
3 19.6
4 29.1
5 25.2
6 21.4
7 22.0
8 27.5
9 33.5
10 20.6
11 29.9
12 17.7
13 24.0
14 28.9
15 37.7
16 18.3
17 19.8
18 29.8
19 29.7
20 31.7
21 23.8
22 44.9
23 19.2
24 28.7
25 28.5
26 19.3
27 31.0
28 25.1
29 22.8
30 30.9
31 26.5
32 21.2
33 40.6
34 21.9
35 26.0
36 23.5
37 22.8
38 20.7
39 20.5
40 21.9
> t.test(men,women,alternative="two.sided",var.equal=TRUE)

Two Sample t-test


data: men and women
t = 0.23081, df = 78, p-value = 0.8181
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-1.963527 2.478527
sample estimates:
mean of x mean of y
25.9975 25.7400
Analysis:
The 95% confidence interval is (1.963527, 2.478527).
Hypothesis Testing:
0 : 1 = 2
1 : 1 2
= 0.05
Test Statistic: t = 0.23081
Critical value: = 1.990(from t-distribution tables we use df = 80)
Decision: Since the test statistic t = 0.23081 < 1.990, we fail to reject 0 .

Вам также может понравиться