#A. Make a pretty figure showing the data, your results, and the 95% confidence interval around the fitted values. Use these data to address the following questions.
nectar.ul<c(10.6,10.6,10,11.1,10.3,10.3,10.4,10.5,10.6,10.4,10.1,10.4,10.2,10.8,10.3,9.9,11.4,10.3,9.9,10.1,10.7,10.1,10.2,10,10.2,9.9,10.5,11,9.9,11,10.9,10.9,10.8,10,10.5,10.1,10.1,10.2,10.3,9.7,9.6,10.7,10.3,10,9.6,10.7,10,9.7,10.6,10.6,10.2,10,10,10.2,10.2,10.3,10.2,11.1,10.5,11,10.4,10.2,10.4,10.2,10,10.2,11.1,10.2,10,11.1,9.9,10.8,10,9.6,10.8,10.9,10.3,10.2,10.1,10)
gall.mm<c(19.86,20.44,19.54,20.55,20.13,19.82,19.82,20.45,20.02,20.22,19.72,19.6,20.41,19.93,19.39,19.74,20.4,20.69,19.7,19.95,20.08,20.44,19.84,19.55,20.12,19.49,19.65,19.74,20.24,20.28,20.25,19.41,20.72,20.04,20.33,19.86,19.93,19.85,19.47,19.41,20.05,20.06,19.97,20.39,19.35,20.29,19.54,19.49,20.08,20.42,21.07,19.66,20.31,19.87,20.24,20.12,19.25,20.03,19.92,20.11,19.9,19.66,20.16,20.37,20.25,20.01,20.36,19.56,20.03,20.77,20.28,20.02,19.6,20.01,19.42,20.18,19.54,19.6,20.21,19.47)
#B. Use an anova to test the null hypothesis that the slope is different from zero.
model1<-lm(gall.mm~nectar.ul)
summary(model1)
plot(nectar.ul,gall.mm)
points(model1$fitted.values,col="red")
plot(model1$fitted.values,model1$residuals)
newx <- seq(min(nectar.ul), max(nectar.ul),
length.out=80)
preds <- predict(model1, newdata = data.frame(x=newx),
interval = 'confidence')
# plot
plot(model1$fitted.values ~ nectar.ul)
# add fill
polygon(c(rev(newx), newx), c(rev(preds[ ,3]), preds[ ,2]), col =
'grey80', border = NA)
# model
abline(model1)
# intervals
lines(newx, preds[ ,3], lty = 'dashed', col = 'red')
lines(newx, preds[ ,2], lty = 'dashed', col = 'red')
The P-value of predictor variable <0.05 Thus the slope of the predictor is significant. We reject the null hypothesis that slope is zero.
> summary(model1) Call: 1m(formula-gall.mm - nectar.ul) Residuals: -0.75634 -0. 27481 -0.03127 0. 27339 1.13139 Coefficients: Min 1Q Median 3Q Max Estimate std. Error t value Pr(ltI) (Intercept) 16. 6203 nectar.ul 1.0368 16. 030
Get Answers For Free
Most questions answered within 1 hours.