STAT3220FA23Unit4BClasswork

pdf

School

University of Virginia *

*We aren’t endorsed by this school

Course

3220

Subject

Statistics

Date

Apr 3, 2024

Type

pdf

Pages

10

Uploaded by AgentTeamDeer43

Report
STAT 3220 Unit 4.3-4.4 Classwork 1. In the production of commercial eggs in Europe, four different types of housing systems for the chickens are used: cage, barn, free range, and organic. The characteristics of eggs produced from the four housing systems were investigated in Food Chemistry (Vol. 106, 2008). Twenty-four commercial grade A eggs were randomly selected—six from each of the four types of housing systems. Of the six eggs selected from each housing system, three were Medium weight class eggs and three were Large weight class eggs. The data on whipping capacity (percent overrun) for the 24 sampled eggs are shown in the next table. The researchers want to investigate the effect of both housing system and weight class on the mean whipping capacity of the eggs. In particular, they want to know whether the difference between the mean whipping capacity of medium and large eggs depends on the housing system. a. Identify the components of the experimental design. This is a completely randomized design because subjects are randomly assigned to treatments. There are two factors , housing systems with four levels : cage, barn, free range, and organic, and weight class with 2 levels : medium and large. Therefore, there are 8 treatments . It is balanced because each treatment has the same number of experimental units . The response variable is the whipping capacity (percent overrun). b. Perform a two-factor ANOVA to test the difference in the means across the treatment groups. Include the output only. egganova<-aov(OVERRUN~HOUSING*WTCLASS, data=eggdata) summary(egganova) Df Sum Sq Mean Sq F value Pr(>F) HOUSING 3 7249 2416.5 19.882 1.2e-05 *** WTCLASS 1 187 187.0 1.539 0.233 1
HOUSING:WTCLASS 3 289 96.3 0.792 0.516 Residuals 16 1945 121.5 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 c. From the analysis in part b, is there evidence of interaction between housing system and weight class? Test using alpha = .05. Include the hypotheses, the test statistic, and p-value. What does this imply, practically? • Null Hypothesis 𝐻 0 ∶ 𝜇 ?𝐴??,? = 𝜇 ?𝐴??,? = 𝜇 ?𝑅??,? = 𝜇 ?𝑅??,? = ... = 𝜇 ?𝑅?𝐴???,? (there are 8 means) • Alternative Hypothesis at least two means are different • Distribution of Test Statistic: F with 3, 16 DF • Test Statistic F test: F = 0.792 with pvalue 0.516 • CONCLUSION: With a pvalue this large, we fail to reject the null hypothesis. There is not evidence of an interaction. This means that the whipping capacity for each level of house system does not depend on the weight class. # examining interaction interaction.plot(eggdata$HOUSING, eggdata$WTCLASS, eggdata$OVERRUN,fun=mean, trace.label="Weight Class" , xlab="Housing system",ylab="Mean percent overrun", main="Interaction Plot Housing system X Weight Class") 2
480 490 500 510 520 530 Interaction Plot Housing system X Weight Class Housing system Mean percent overrun BARN CAGE FREE ORGANIC Weight Class L M 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2. Pediatric researchers at Pennsylvania State University carried out a designed study to test whether a teaspoon of honey before bed calms a child’s cough and published their results in Archives of Pediatrics and Adolescent Medicine (December 2007). A sample of 105 children who were ill with an upper respiratory tract infection and their parents participated in the study. On the first night, the parents rated their children’s cough symptoms on a scale from 0 (no problems at all) to 6 (extremely severe) in five different areas. The total symptoms score (ranging from 0 to 30 points) was the variable of interest for the 105 patients. On the second night, the parents were instructed to give their sick child a dosage of liquid “medicine” prior to bedtime. Unknown to the parents, through randomization, some were given a dosage of dextromethorphan (DM) — an over-the-counter cough medicine—while others were given a similar dose of honey. Also, a third group of parents (the control group) gave their sick children no dosage at all. Again, the parents rated their children’s cough symptoms, and the improvement in total cough symptoms score was determined for each child. The goal of the researchers was to compare the mean improvement scores for the three treatment groups. a. Is the normality assumption met? Why or why not? The normality assumption is met because the histogram appears approximately symmetric and is unimodal. Also, there appears to be no obvious skew. #Use this to assess Normality table(coughdata$Treatment) C DM H 37 33 35 par(mfcol=c(2,2)) hist(coughdata$TotalScore, xlab="TotalScore", main="Histogram of Response") for (i in unique(coughdata$Treatment)){ hist(coughdata$TotalScore[coughdata$Treatment==i], xlab="Strength", main = paste("Histogram of Response for Treatment", i))} 4
Histogram of Response TotalScore Frequency 0 5 10 15 0 10 20 Histogram of Response for Treatment H Strength Frequency 4 6 8 10 12 14 16 0 4 8 Histogram of Response for Treatment D Strength Frequency 2 4 6 8 10 12 14 16 0 4 8 Histogram of Response for Treatment C Strength Frequency 0 2 4 6 8 10 12 0 6 12 qqPlot(coughdata$TotalScore, groups=coughdata$Treatment) 5
-2 -1 0 1 2 0 5 15 coughdata$Treatment = C norm quantiles coughdata$TotalScore 73 72 -2 -1 0 1 2 0 5 15 coughdata$Treatment = DM norm quantiles coughdata$TotalScore 67 48 -2 -1 0 1 2 0 5 15 coughdata$Treatment = H norm quantiles coughdata$TotalScore 8 34 tapply(coughdata$TotalScore,coughdata$Treatment,summary) $C Min. 1st Qu. Median Mean 3rd Qu. Max. 0.000 5.000 7.000 6.514 8.000 12.000 $DM Min. 1st Qu. Median Mean 3rd Qu. Max. 3.000 6.000 9.000 8.333 11.000 15.000 $H Min. 1st Qu. Median Mean 3rd Qu. Max. 4.00 9.00 11.00 10.71 12.00 16.00 b. Which Test of homogeneity should you perform? Why? We would use the Bartlett test for homogeneity because the data has a normal distribution and the test statistic follows a Chi-Square distribution. Also, the normality assumption was met. 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
c. What is your conclusion from the equal variance test? The null hypothesis is that the variance of each treatment is equal. With a p-value this large of 0.7294, we fail to reject the null hypothesis, so we determine the equal variance assumption is met. #Use this to assess equal variance bartlett.test(TotalScore~Treatment, data=coughdata) Bartlett test of homogeneity of variances data: TotalScore by Treatment Bartlett's K-squared = 0.63112, df = 2, p-value = 0.7294 boxplot(TotalScore ~ Treatment, data = coughdata) C DM H 0 5 10 15 Treatment TotalScore d. Perform an ANOVA to test the difference in the means of each treatment group. Include the hypotheses, the test statistic, and p-value. (using alpha = .05) 7
#Perform ANOVA coughanova <- aov(TotalScore~Treatment, data=coughdata) summary(coughanova) Df Sum Sq Mean Sq F value Pr(>F) Treatment 2 318.5 159.2 17.51 2.9e-07 *** Residuals 102 927.7 9.1 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Null Hypothesis : 𝐻 0 ∶ 𝜇 ? = 𝜇 ?? = 𝜇 ? Alternative Hypothesis : at least two means are different Test Statistic F test : F = MST/MSE = 159.2/9.1 = 17.49 Distribution of Test Statistic : F with numerator degrees of freedom, ￿1 = 3-1 = 2 and denominator degrees of freedom, ￿2 = 105 − 3 = 102 CONCLUSION : With a pvalue this small, we reject the null hypothesis. There is evidence that at least two treatment means are different from each other. Based on the sample means, it appears the group that was the control was much lower than the rest, while the group using honey had a higher mean than the rest. We will perform the post-hoc test to compare pairwise means in the next section. e. Is it appropriate to perform Tukey’s Multiple Comparison test? Why or why not? It is not appropriate to perform Tukey’s multiple comparison test because the sample sizes for each treatment must be equal for the test, which is not the case here since it is not balanced. f. Which pairs of treatment means are significantly different? The pair of treatment means that are significantly different and the most different are honey and control group as the difference is 4.200772. Every pair is different, however, as there is a difference between honey and dextromethorphan of 2.380952 and there is a difference of 1.819820 between the control and dextromethorphan. To conclude, all the pairs are significantly different. 8
#Post Hoc Analysis TukeyHSD(coughanova,conf.level=.95) Tukey multiple comparisons of means 95% family-wise confidence level Fit: aov(formula = TotalScore ~ Treatment, data = coughdata) $Treatment diff lwr upr p adj DM-C 1.819820 0.1023625 3.537277 0.0351562 H-C 4.200772 2.5094509 5.892094 0.0000001 H-DM 2.380952 0.6405157 4.121389 0.0043728 plot(TukeyHSD(coughanova,conf.level=.95)) 0 1 2 3 4 5 6 H-DM H-C DM-C 95% family-wise confidence level Differences in mean levels of Treatment 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
table(coughdata$Treatment) C DM H 37 33 35 10