a3_09sol

a3_09sol - The University of Western Ontario Department of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The University of Western Ontario Department of Statistical and Actuarial Sciences Statistical Sciences 3859A Assignment 3 1. The data is sourced into R from bottlerolling.R : source("bottlerolling.R") (a) The preliminary plots, pictured in Figure 1 can be obtained using par(mfrow=c(1,2)) plot(distance ~ water, data=bottlerolling, pch=16) plot(distance ~ rampheight, data=bottlerolling, pch=16) 50 100 150 200 250 100 150 200 250 300 water distance 20 25 30 35 40 100 150 200 250 300 rampheight distance Figure 1: Scatterplots of data from bottle rolling experiment. Patterns: After dropping sharply at a water mass of 0, distance tends to increase with mass of water. Distance tends to increase with ramp height. Variability in distance appears to increase with both variables. (b) To remove the observations for which the water amount was 0 g, use bottle0 <- subset(bottlerolling, water!=0) (c) To fit a multiple regression model relating distance to the other two variables, start with dist.lm <- lm(distance ~ rampheight + water, data=bottle0) plot(dist.lm, which=1) 50 100 150 200 250 30 20 10 10 20 30 Fitted values Residuals lm(distance ~ rampheight + water) Residuals vs Fitted 13 20 17 Figure 2: Residual plot for linear regression model without transformation or interaction. The resulting residual plot is pictured in Figure 2. This plot indicates that this model is not adequate for the data at all. The following models are based on square root transformations of ramp height and/or distance and/or interactions between water and ramp height: par(mfrow=c(1,4)) dist.lm1 <- lm(sqrt(distance) ~ rampheight+water, data=bottle0) dist.lm2 <- lm(sqrt(distance) ~ rampheight*water, data=bottle0) dist.lm3 <- lm(sqrt(distance) ~ sqrt(rampheight)*water, data=bottle0) dist.lm4 <- lm(distance ~ sqrt(rampheight)*water, data=bottle0) plot(dist.lm1, which=1) plot(dist.lm2, which=1) plot(dist.lm3, which=1) plot(dist.lm4, which=1) Residual plots for each of these four models are pictured in Figure 3. None of the models is perfect, but the third one appears to give a residual plot without as much of a pattern as any of the others. This model requires a square root transformation of both distance and ramp height, and there is an interaction between ramp height and water....
View Full Document

Page1 / 8

a3_09sol - The University of Western Ontario Department of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online