In: Statistics and Probability
In a study, sixteen pregnancy women were selected to compare the plasma ascorbic acid levels for smokers versus nonsmokers. Prior to the collection of 20 ml of blood, the participants were told to avoid breakfast, forgo their vitamin supplements, and avoid foods high in ascorbic acid content. From the blood samples, the following plasma ascorbic acid values were determined, in milligrams per 100 milliliters:
Plasma Ascorbic Acid Values
Nonsmokers Smokers
0.97 0.48
0.72 0.71
1 0.98
0.81 0.68
0.62 1.18
1.32 1.36
1.24 0.78
0.99 1.64
Please write the entire R code to check the assumptions
necessary and to perform the test.
(1) Do the data provide sufficient evidence to indicate that
smokers have a lower mean plasma ascorbic
acid levels than the nonsmokers.
(2) Perform one-way ANOV A for the plasma ascorbic acid levels of
smokers and nonsmokers, is there
sufficient evidence to conclude that there is a difference between plasma ascorbic acid levels of smokers and nonsmokers?
The R code is pasted below.
# DATA IS ENTERED AND ARRANGED
x =
c(0.97,0.72,1,0.81,0.62,1.32,1.24,0.99,0.48,0.71,0.98,0.68,1.18,1.36,0.78,1.64)
y = c(rep("Nonsmokers",8),rep("Smokers",8))
data = data.frame(Acid.Values = x,Category = y)
data
# IN QUESTION 1, WE HAVE TO PERFORM A RIGHT-TAILED, 2
INDEPENDENT SAMPLES T-TEST
# SUBSETTING THE DATA ACCORDINGLY
nonsmokers = unlist(subset(data,Category ==
"Nonsmokers",select=Acid.Values),use.names=F)
smokers = unlist(subset(data,Category ==
"Smokers",select=Acid.Values),use.names=F)
t.test(nonsmokers,smokers,alternative = "greater",var.equal =
T)
# SINCE P-VALUE IS GREATER THAN ALPHA = 0.05, WE FAIL TO REJECT
H0.
# WE CONCLUDE THAT THERE IS NO SUFFICIENT EVIDENCE TO SUGGEST THAT
SMOKERS HAVE A LOWER MEAN PLASMA ASCORBIC ACID LEVELS THAN
NONSMOKERS.
# IN QUESTION 2, WE PERFORM THE ONE-WAY ANOVA
res.aov = aov(Acid.Values ~ Category,data)
summary(res.aov)
# SINCE P-VALUE IS GREATER THAN ALPHA = 0.05, WE FAIL TO REJECT
H0.
# WE CONCLUDE THAT THERE IS NO SUFFICIENT EVIDENCE TO SUGGEST THAT
THERE IS A DIFFERENCE BETWEEN THE PLASMA ASCORBIC ACID LEVELS OF
SMOKERS AND NONSMOKERS.