Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Effects of Sinker Weight and Rod Length on Cast Distance: Two-Way ANOVA Analysis, Study notes of Statistics

An analysis of a fishing data set using a two-way anova to investigate the effects of sinker weight and rod length on the distance cast. Data preprocessing, plotting interaction plots, and fitting a linear model with interaction. The results indicate that both sinker weight and rod length have significant effects on distance cast.

Typology: Study notes

Pre 2010

Uploaded on 09/17/2009

koofers-user-159
koofers-user-159 ๐Ÿ‡บ๐Ÿ‡ธ

10 documents

1 / 4

Toggle sidebar

Related documents


Partial preview of the text

Download Effects of Sinker Weight and Rod Length on Cast Distance: Two-Way ANOVA Analysis and more Study notes Statistics in PDF only on Docsity! 22s:152 Applied Linear Regression Chapter 8: Two-Way ANOVA โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€” โ€ข Example: A balanced two-way ANOVA without significant interaction * Fishing Data โ€“ Objective: to see if sinker weight and/or rod length a!ect the distance the line is cast, and if the rod e!ect (if present) is the same for di!ering sinker weight (i.e. see if there is interaction). โ€“ Variables: Distance distance line cast in meters Sinker factor with levels: 8 oz./12 oz. Rod factor with levels: 6 ft./7 ft. 1 โ€ข Example: Fishing data > rodsink=read.csv("rod_and_sinker.csv") > attach(rodsink) > head(rodsink) rod sinker distance order 1 1 1 28.0 1 2 1 1 30.5 2 3 1 1 31.0 6 4 1 1 30.0 5 5 2 1 33.5 9 6 2 1 35.0 10 > is.factor(rod) [1] FALSE > is.factor(sinker) [1] FALSE The variables rod and sinker were entered as numbers in the data file rather than letters, so we have to tell R that these are factors (or it will see them as continuous data). If rod=1 ! 6 foot rod If sinker=1 ! 8 oz. sinker 2 ## Re-assign the variables to be โ€˜factorsโ€™: > rod=as.factor(rod) > sinker=as.factor(sinker) > is.factor(sinker) [1] TRUE > is.factor(rod) [1] TRUE > sinker [1] 1 1 1 1 1 1 2 2 2 2 2 2 1 1 2 2 Levels: 1 2 > rod [1] 1 1 1 1 2 2 2 2 2 2 1 1 2 2 1 1 Levels: 1 2 > nrow(rodsink) [1] 16 > table(sinker,rod) rod sinker 1 2 1 4 4 2 4 4 This is a balanced two-way ANOVA. 3 Get the interaction plot of the means: > interaction.plot(sinker,rod,distance) 3 0 3 2 3 4 3 6 3 8 sinker m e a n o f d is ta n c e 1 2 rod 2 1 > means=tapply(distance,list(sinker,rod),mean) > means 1 2 1 29.875 35.75 2 35.625 39.50 First factor listed is represented in the rows. 4 Get a more sophisticated plot: > plot(c(0.75,2.25),range(distance),type="n", xlab="Sinker",ylab="effectiveness",axes=F) > axis(2) > axis(1,at=1:2,c("8 ounces","12 ounces")) > box() > points(jitter(as.numeric(sinker[rod==1]),factor=.15), distance[rod==1],pch="1",col=1) > points(jitter(as.numeric(sinker[rod==2]),factor=.15), distance[rod==2],pch="2",col=2) > lines(c(1,2),means[,1],col=1) > lines(c(1,2),means[,2],col=2) > legend(1,42,c("Rod: 6 feet","Rod: 7 feet"), col=c(1,2),lty=1) 5 Sinker d is ta n c e 2 8 3 0 3 2 3 4 3 6 3 8 4 0 4 2 8 ounces 12 ounces 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 Rod: 6 feet Rod: 7 feet As the primitive interaction plot also sug- gested, there may be some slight interaction (weโ€™ll test for this). But even if there is in- teraction, having a rod of 7 feet is better at both levels of sinker weights. 6 Before fitting the linear model, we will change our dummy regressor coding to the sum-to- zero constraint. > contrasts(rod) 2 1 0 2 1 ## Reassign as sum-to-zero contraint dummy regressors: > contrasts(rod)=contr.sum(levels(rod)) > contrasts(rod) [,1] 1 1 2 -1 > contrasts(sinker) 2 1 0 2 1 ## Reassign as sum-to-zero contraint dummy regressors: > contrasts(sinker)=contr.sum(levels(sinker)) > contrasts(sinker) [,1] 1 1 2 -1 7 Fit the linear model with interaction: > lm.out=lm(distance ~ sinker + rod + sinker:rod) > summary(lm.out) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 35.1875 0.5135 68.526 < 2e-16 *** sinker1 -2.3750 0.5135 -4.625 0.000585 *** rod1 -2.4375 0.5135 -4.747 0.000475 *** sinker1:rod1 -0.5000 0.5135 -0.974 0.349411 --- Residual standard error: 2.054 on 12 degrees of freedom Multiple R-squared: 0.789,Adjusted R-squared: 0.7363 F-statistic: 14.96 on 3 and 12 DF, p-value: 0.0002341 Items provided by the โ€˜summaryโ€™ output: 1) Overall F-test (reject, thus something in the model is useful for explaining the vari- ability in distance). (2) "Test for dummy regressors. In this case, since there is only 1 dummy regressor for each factor, this gives us the tests for main e!ects of sinker and rod. 8
Docsity logo



Copyright ยฉ 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved