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

Analysis of Variety Effect in Wheat Yield using RBD, Study notes of Data Analysis & Statistical Methods

An r script example for analyzing the yield of different wheat varieties using a randomized block design (rbd). The script reads the data, defines variables, performs a one-way analysis of variance (anova) ignoring blocks, and then performs a proper rbd analysis with both variety and block as factors. The results show significant effects for both variety and block, and a contrast analysis is used to determine if variety a has a superior mean yield to the others.

Typology: Study notes

Pre 2010

Uploaded on 09/02/2009

koofers-user-ue2-2
koofers-user-ue2-2 🇺🇸

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Analysis of Variety Effect in Wheat Yield using RBD and more Study notes Data Analysis & Statistical Methods in PDF only on Docsity! > # This example shows the analyses for the RBD > # using the wheat data example we looked at in class > > # Entering the data and defining the variables: > > ########## > ## > # Reading the data into R: > > my.datafile <- tempfile() > cat(file=my.datafile, " + A 1 31.0 + A 2 39.5 + A 3 30.5 + A 4 35.5 + A 5 37.0 + B 1 28.0 + B 2 34.0 + B 3 24.5 + B 4 31.5 + B 5 31.5 + C 1 25.5 + C 2 31.0 + C 3 25.0 + C 4 33.0 + C 5 29.5 + ", sep=" ") > > options(scipen=999) # suppressing scientific notation > > wheat <- read.table(my.datafile, header=FALSE, col.names=c("variety", "block", "yield")) > > # Note we could also save the data columns into a file and use a command such as: > # wheat <- read.table(file = "z:/stat_516/filename.txt", header=FALSE, col.names = c("variety", "block", "yield")) > > attach(wheat) > > # The data frame called wheat is now created, > # with three variables, variety, block, and yield. > ## > ######### > > ################################################################** > # What if we ignored the blocks and just did a one-way CRD ANOVA? > > # We specify that variety is a (qualitative) factor with the factor() function: > > # Making "variety" a factor: > > variety <- factor(variety) > > # The lm statement specifies that yield is the response > # and variety is the factor > # The ANOVA table is produced by the anova() function > > wheat.fit <- lm(yield ~ variety); > anova(wheat.fit) Analysis of Variance Table Response: yield Df Sum Sq Mean Sq F value Pr(>F) variety 2 98.433 49.217 3.6167 0.05899 . Residuals 12 163.300 13.608 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > # The effect of variety is not significant at the 5% level (p-value = .0590). > # This is NOT the best way to analyze these data!!!! > > ############################################################################### > # Here we treat the experiment as a Randomized Block Design (RBD). > # The lm() and anova() functions will do a standard ANOVA for a RBD. > > # We specify that block and variety are factors with the factor() function: > > variety <- factor(variety) > block <- factor(block) > > wheat.RBD.fit <- lm(yield ~ variety + block); > anova(wheat.RBD.fit)
Docsity logo



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