A new drug for canines has been proposed for over dogs with arthritis. We wish t
ID: 3241235 • Letter: A
Question
A new drug for canines has been proposed for over dogs with arthritis. We wish to study the eect of the dosage on basal (resting) heart rate. Three dierent dosages are given to three dierent groups of Labrador Retrievers randomly sampled from the general population. The data can be entered into R by typing the following commands into R or by uploading the le “heartrates.csv” which is in Canvas
y = c(71.00, 75.00, 79.67, 81.00, 75.50, 72.50, 73.50, 78.50, 78.50, 63.00, 68.00, 73.00, 76.00, 79.67, 81.00, 68.67, 73.70, 78.40, 84.40, 91.20, 87.15, 77.20, 80.70, 84.85, 88.40) dose = rep(c(10,20,25),c(9,6,10)) dose=factor(dose) D=data.frame(y=y,dose=dose)
(b) Test to see if the residuals have constant variance by using the leveneTest() function in the “car” package in R. Or using the levene.test() function in the “lawstat” package.
(c) Use the qqnorm() and qqline() functions in R to produce a QQ-plot of the ANOVA model residuals. Does the plot indicate that the residuals are normally distributed? Use the shapiro.test() function on the ANOVA model residuals to test if the residuals are normally distributed. What do you conclude from this?
(d) Type the following into R to produce the 4 default residual plots in R. par(mfrow=c(2,2)) plot(anovamodel) Comment on what each plot tells us.
(e) Install the library “multcomp” and then type the following into R comparisons <- glht(anovamodel, linfct=mcp(group="Tukey")) summary(comparisons,test=adjusted("none")) summary(comparisons, test=adjusted(type="bonferroni")) summary(comparisons) confint(comparisons) This will produce the Fisher’s LSD comparisons, the Bonferroni type comparisons and the Tukey HSD comparisons, respectively. Comment on what each method does and interpret the results of each comparison.
Explanation / Answer
(b)
rm(list=ls(all=TRUE))
library(car)
y = c(71.00, 75.00, 79.67, 81.00, 75.50, 72.50, 73.50, 78.50, 78.50, 63.00, 68.00, 73.00, 76.00, 79.67, 81.00, 68.67, 73.70, 78.40, 84.40, 91.20, 87.15, 77.20, 80.70, 84.85, 88.40)
dose = rep(c(10,20,25),c(9,6,10))
dose=factor(dose)
D=data.frame(y=y,dose=dose)
levene.test(y, dose)
Levene's Test for Homogeneity of Variance (center = median)
Df F value Pr(>F)
group 2 2.1658 0.1385
22
P-value is greater than 0.05, so, there is a variance homogeneity.
(c)
qqnorm(y);
qqline(y, col = 2)
Yes, the plot indicate that the residuals are normally distributed which can also verify by test
shapiro.test(y)
Shapiro-Wilk normality test
data: y
W = 0.99035, p-value = 0.9964
The p-value is greater than the chosen alpha level, then the null hypothesis is not rejected and there is evidence that the data tested are from a normally distributed population.
(d)
anova( r <- lm(y~dose) )
par(mfrow=c(2,2))
plot(r)
Residuals vs. fitted plot for verifying the assumptions of a linear model. Plot seems to indicate that the residuals and the fitted values are uncorrelated, as they should be in a homoscedastic linear model with normally distributed errors.
scale-location plots says that data is homoscedasticity.
NOrmal plot says that data is normally distributed.
(e) The package is not install tell now.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.