Docsity

Introductory Applied Statistics/Life Sciences - Assignment 10 Solved | STAT 371, Assignments of Statistics

Toggle sidebar
bg1
Statistics 371 Solutions #10 Fall 2002
This assignment includes problems related to paired samples and analysis of two-way categorical data.
1. Exercise 9.2 (page 356). (Note. If you wish, you can use the command t.test with the option paired=T to do this
problem.)
Data compares weight gain in pounds over 140 days for pairs of beef steers paired by hereditary factors.
Solution: Here is a solution in R.
> diet1 <- c(596, 422, 524, 454, 538, 552, 478, 564, 556)
> diet2 <- c(498, 460, 468, 458, 530, 482, 528, 598, 456)
> se <- sqrt(var(diet1 - diet2)/length(diet1 - diet2))
> se
[1] 19.75717
> ts <- 22.9/(59.3/sqrt(9))
> ts
[1] 1.158516
> t.test(diet1, diet2, paired = T, conf.level = 0.9)
Paired t-test
data: diet1 and diet2
t = 1.1585, df = 8, p-value = 0.2801
alternative hypothesis: true difference in means is not equal to 0
90 percent confidence interval:
-13.85051 59.62829
sample estimates:
mean of the differences
22.88889
We are 90% confident that the mean 140-day weight gain (in pounds) of all beef steers from a given herd would be between
13.9 pounds less or 59.6 pounds more when on Diet 1 than when on Diet 2.
There is data is consistent with a hypothesis of no mean difference in weight gain for the two diets (two-sided p-value =
0.28 from a paired t-test).
2. Exercise 9.6 (page 357).
Two drugs are tested for their effect on a psychiatric illness in which victims have irrestible urges to pull their own
hair in a double-blind experiment in which each woman in the study is measured in two separate time periods,
one while using each drug. A two-tailed p-value is 0.03. Interpret the result.
Solution: There is strong evidence that the two drugs have different effects on impairment due to hair pulling (two-sided
p-value = 0.03 from a paired t-test). Desipramine is more effective than clomipramine for these subjects.
3. Exercise 9.24 (page 373).
This study examines 33 male coffee drinkers with high cholesterol to see if not drinking coffee reduced their
cholesterol level.
Solution: I will show the calculations in R.
(a) Test significance of the 35 mg/dl drop in cholesterol for the no-coffee group. This is a paired t-test where each
man’s cholesterol is compared to a measurement for the man at baseline.
> ts <- -35/(27/sqrt(25))
> ts
[1] -6.481481
Bret Larget November 10, 2002
pf3
pf4
pf5

Partial preview of the text

Download Introductory Applied Statistics/Life Sciences - Assignment 10 Solved | STAT 371 and more Assignments Statistics in PDF only on Docsity!

This assignment includes problems related to paired samples and analysis of two-way categorical data.

  1. Exercise 9.2 (page 356). (Note. If you wish, you can use the command t.test with the option paired=T to do this problem.) Data compares weight gain in pounds over 140 days for pairs of beef steers paired by hereditary factors. Solution: Here is a solution in R.

diet1 <- c(596, 422, 524, 454, 538, 552, 478, 564, 556) diet2 <- c(498, 460, 468, 458, 530, 482, 528, 598, 456) se <- sqrt(var(diet1 - diet2)/length(diet1 - diet2)) se

[1] 19.

ts <- 22.9/(59.3/sqrt(9)) ts

[1] 1.

t.test(diet1, diet2, paired = T, conf.level = 0.9)

Paired t-test

data: diet1 and diet t = 1.1585, df = 8, p-value = 0. alternative hypothesis: true difference in means is not equal to 0 90 percent confidence interval: -13.85051 59. sample estimates: mean of the differences

We are 90% confident that the mean 140-day weight gain (in pounds) of all beef steers from a given herd would be between 13.9 pounds less or 59.6 pounds more when on Diet 1 than when on Diet 2. There is data is consistent with a hypothesis of no mean difference in weight gain for the two diets (two-sided p-value = 0.28 from a paired t-test).

  1. Exercise 9.6 (page 357). Two drugs are tested for their effect on a psychiatric illness in which victims have irrestible urges to pull their own hair in a double-blind experiment in which each woman in the study is measured in two separate time periods, one while using each drug. A two-tailed p-value is 0.03. Interpret the result. Solution: There is strong evidence that the two drugs have different effects on impairment due to hair pulling (two-sided p-value = 0.03 from a paired t-test). Desipramine is more effective than clomipramine for these subjects.
  2. Exercise 9.24 (page 373). This study examines 33 male coffee drinkers with high cholesterol to see if not drinking coffee reduced their cholesterol level. Solution: I will show the calculations in R.

(a) Test significance of the 35 mg/dl drop in cholesterol for the no-coffee group. This is a paired t-test where each man’s cholesterol is compared to a measurement for the man at baseline.

ts <- -35/(27/sqrt(25)) ts [1] -6.

2 * pt(ts, 24) [1] 1.055815e- If this group had been randomly sampled from a population, there would be strong evidence that stopping coffee drinking and participating in the study would decrease cholesterol. (b) Test significance of the 26 mg/dl rise in cholesterol for the usual-coffee group. This is a paired t-test where each man’s cholesterol is compared to a measurement for the man at baseline. ts <- 26/(56/sqrt(8)) ts [1] 1. 2 * pt(-ts, 7) [1] 0. The increase in cholesterol level for this group is consistent with chance variation. There is insufficient evidence to conclude that participating in the study changed the cholesterol level for this group. (c) Use a t-test to compare the groups. This is an independent samples t-test. se <- sqrt(27^2/25 + 56^2/8) ts <- (-35 - 26)/se df2sample <- function(se1, n1, se2, n2) {

  • return((se1^2 + se2^2)^2/(se1^4/(n1 - 1) + se2^4/(n2 - 1)))
  • }

df <- df2sample(27/sqrt(25), 25, 56/sqrt(8), 8) df [1] 8. p <- 2 * pt(ts, df) p [1] 0. (d) State conclusions to part (c). There is strong evidence that not drinking coffee lowers cholesterol level in this population and that the difference is not due to participation in the study alone (two-sided p-value = 0.018, independent samples t-test).

  1. Exercise 9.32 (page 378). (Note. If you wish, you can use the command t.test with the option paired=T to do this problem.) Data is on moisture content in wheat in seeds in the center or top of the wheat head. Find a 90% confidence interval for the difference. Solution: This is a paired experiment, so we begin by taking individual differences. Here is one way to do this in R.

central <- c(62.7, 63.6, 60.9, 63, 62.7, 63.7) top <- c(59.7, 61.6, 58.2, 60.5, 60.6, 60.8) t.test(central, top, paired = T, conf.level = 0.9)

Paired t-test

data: central and top t = 15.0208, df = 5, p-value = 2.368e- alternative hypothesis: true difference in means is not equal to 0 90 percent confidence interval: 2.193486 2. sample estimates: mean of the differences

n <- 1000 observed <- c(0.52, 0.48) * n expected <- c(0.5, 0.5) * n x2 <- sum((observed - expected)^2/expected) x

[1] 1.

1 - pchisq(x2, 1)

[1] 0.

n <- 3000 observed <- c(0.52, 0.48) * n expected <- c(0.5, 0.5) * n x2 <- sum((observed - expected)^2/expected) x

[1] 4.

1 - pchisq(x2, 1)

[1] 0.

n <- 6000 observed <- c(0.52, 0.48) * n expected <- c(0.5, 0.5) * n x2 <- sum((observed - expected)^2/expected) x

[1] 9.

1 - pchisq(x2, 1)

[1] 0.

We see that the p-value gets smaller as the sample size increases.

  1. Exercise 10.18 (page 402). Compare the effectiveness of two products designed to bring cows into heat at predictable times so that they can be impregnated by artificial insemination more reliably. Solution:

(a) State the null hypothesis in words. Both products are equally effective at producing pregnant cows. (b) State the null hypothesis in symbols. Let pA and pB be the probabilities that cows become pregnant using product A and B respectively. Then the null hypothesis is H 0 : pA = pB. (c) Find the test statistic and the p-value. I’ll use R.

observed <- matrix(c(8, 13, 15, 6), 2, 2) rsum <- apply(observed, 1, sum) csum <- apply(observed, 2, sum) gsum <- sum(rsum) expected <- (rsum %o% csum)/gsum expected [,1] [,2] [1,] 11.5 11. [2,] 9.5 9.

x2 <- sum((observed - expected)^2/expected) x [1] 4. 1 - pchisq(x2, (length(rsum) - 1) * (length(csum) - 1)) [1] 0.

(d) State a conclusion in the context of the setting. There is fairly strong evidence that the two products are not equally effective in leading to pregnant cows (p-value = 0.03 in a χ^2 test). Product B appears to be more effective.