case1802: Vitamin C and the Common Cold

Description Usage Format Source References Examples

Description

In a randomized experiment, researchers assigned 407 volunteers to receive 1,000 mg of Vitamin C daily throughout the cold season and 411 to receive a placebo. A physician interviewed the volunteers at the end of the study to determine whether or not they had suffered any colds during the study period.

Usage

1

Format

A data frame with 2 observations on the following 3 variables.

Treatment

a factor with levels "Placebo" and "VitC"

Cold

the number of who got colds

NoCold

the number that did not get any colds

Source

Ramsey, F.L. and Schafer, D.W. (2013). The Statistical Sleuth: A Course in Methods of Data Analysis (3rd ed), Cenage Learning.

References

Anderson, T.W., Reid, D.B.W. and Beaton, G. H. (1972). Vitamin C and the Common Cold, Canadian Medial Association Journal 107: 503–508.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
str(case1802)
attach(case1802) 

library(MASS)        
## INFERENCE (4 methods)
myTable <- cbind(Cold,NoCold)
row.names(myTable) <- c("Placebo","Vitamin C")
myTable
prop.test(myTable, alternative="greater") # Compare 2 binomial proportions 
# Alternative: pop prop. of first column (cold) in larger in first row (placebo)    
prop.test(myTable, alternative="greater", correct=TRUE)   
prop.test(myTable,correct=TRUE) # Use 2-sided alternative to get CI    
chisq.test(myTable)   # Chi-square test
fisher.test(myTable, alternative="greater")
fisher.test(myTable) #  2-sided alternative to get CI for odds ratio
myGlm1  <- glm(myTable ~ Treatment, family=binomial) # logistic reg (Ch 21)
summary(myGlm1)
beta    <- myGlm1$coef
1 - exp(beta[2])  # 0.3474911
1 - exp(confint(myGlm1,2)) # 0.53365918 0.09042098
# Interpretation: The odds of getting a cold are 35% less on Vitamin C than 
# Placebo (95% confidence interval: 9% to 53% less).

detach(case1802)

Example output

'data.frame':	2 obs. of  3 variables:
 $ Treatment: Factor w/ 2 levels "Placebo","VitC": 1 2
 $ Cold     : int  335 302
 $ NoCold   : int  76 105
          Cold NoCold
Placebo    335     76
Vitamin C  302    105

	2-sample test for equality of proportions with continuity correction

data:  myTable
X-squared = 5.9196, df = 1, p-value = 0.007487
alternative hypothesis: greater
95 percent confidence interval:
 0.02303649 1.00000000
sample estimates:
   prop 1    prop 2 
0.8150852 0.7420147 


	2-sample test for equality of proportions with continuity correction

data:  myTable
X-squared = 5.9196, df = 1, p-value = 0.007487
alternative hypothesis: greater
95 percent confidence interval:
 0.02303649 1.00000000
sample estimates:
   prop 1    prop 2 
0.8150852 0.7420147 


	2-sample test for equality of proportions with continuity correction

data:  myTable
X-squared = 5.9196, df = 1, p-value = 0.01497
alternative hypothesis: two.sided
95 percent confidence interval:
 0.01391972 0.13222111
sample estimates:
   prop 1    prop 2 
0.8150852 0.7420147 


	Pearson's Chi-squared test with Yates' continuity correction

data:  myTable
X-squared = 5.9196, df = 1, p-value = 0.01497


	Fisher's Exact Test for Count Data

data:  myTable
p-value = 0.007424
alternative hypothesis: true odds ratio is greater than 1
95 percent confidence interval:
 1.14257     Inf
sample estimates:
odds ratio 
  1.531722 


	Fisher's Exact Test for Count Data

data:  myTable
p-value = 0.01444
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 1.083492 2.172490
sample estimates:
odds ratio 
  1.531722 


Call:
glm(formula = myTable ~ Treatment, family = binomial)

Deviance Residuals: 
[1]  0  0

Coefficients:
              Estimate Std. Error z value Pr(>|z|)    
(Intercept)     1.4834     0.1271  11.675   <2e-16 ***
TreatmentVitC  -0.4269     0.1702  -2.508   0.0121 *  
---
Signif. codes:  0***0.001**0.01*0.05.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 6.3573  on 1  degrees of freedom
Residual deviance: 0.0000  on 0  degrees of freedom
AIC: 16.162

Number of Fisher Scoring iterations: 3

TreatmentVitC 
    0.3474911 
Waiting for profiling to be done...
     2.5 %     97.5 % 
0.53365918 0.09042098 

Sleuth3 documentation built on May 2, 2019, 6:41 a.m.