Thank-you very much Richard! This is extremely helpful. I would have never thought of approaching it this way but it makes perfect sense. I'm in awe of the promptness and quality of help/advice I'm receiving on this topic - it reflects very well on the R community. All the best!
Cyril Lundrigan Research Silviculturist Department of Natural Resources Government of Newfoundland and Labrador P.O. Box 2006 Corner Brook, NL A2H 6J8 From: Richard M. Heiberger [mailto:r...@temple.edu] Sent: Thursday, May 09, 2013 3:56 PM To: Lundrigan, Cyril Cc: r-help@r-project.org Subject: Re: [R] Paritioning of Interaction SS in ANOVA - Gomez and Gomez(1984) example Thank you for this example. The way to handle it is with the split argument to the summary.aov function. Look at ?summary.aov for details. I use the reshape package to get the data ordered the way aov wants it. I use the HH package for the graph. ## from: Lundrigan, Cyril <cyrillund...@gov.nl.ca> ## to: r-help@r-project.org ## date: Thu, May 9, 2013 at 7:58 AM ## subject: [R] Paritioning of Interaction SS in ANOVA - Gomez and Gomez(1984) example ## Statistical Procedures in Agricultural Research, by K. A. Gomez and A. A. Gomez. New York, ## Chichester, etc.: Wiley (1984). ## http://pdf.usaid.gov/pdf_docs/PNAAR208.pdf. ## Table 6.14 Data on Nitrogen Content of the Soil, Subjected to Eight ## Fertilizer Treatments In a RCB Design with Four Replications, ## Collected at Three Growth Stages of the Rice Crop ## Soil Nitrogen Content, % ## Treatment Rep. I Rep. II Rep. III Rep. IV ## Number P1 P2 P3 P2 P2 P3 P1 P2 P3 P1 P2 P3 library(reshape) library(HH) GG614.in <- read.table(textConnection(" 1 3.26 1.88 1.40 2.98 1.74 1.24 2.78 1.76 1.44 2.77 2.00 1.25 2 3.84 2.36 1.53 3.74 2.14 1.21 3.09 1.75 1.28 3.36 1.57 1.17 3 3.50 2.20 1.33 3.49 2.28 1.54 3.03 2.48 1.46 3.36 2.47 1.41 4 3.43 2.32 1.61 3.45 2.33 1.33 2.81 2.16 1.40 3.32 1.99 1.12 5 3.43 1.98 1.11 3.24 1.70 1.25 3.45 1.78 1.39 3.09 1.74 1.20 6 3.68 2.01 1.26 3.24 2.33 1.44 2.84 2.22 1.12 2.91 2.00 1.24 7 2.97 2.66 1.87 2.90 2.74 1.81 2.92 2.67 1.31 2.42 2.98 1.56 8 3.11 2.53 1.76 3.04 2.22 1.28 3.20 2.61 1.23 2.81 2.22 1.29 ")) closeAllConnections() names(GG614.in) <- c("Treatment", "I.P1", "I.P2", "I.P3", "II.P1", "II.P2", "II.P3", "III.P1", "III.P2", "III.P3", "IV.P1", "IV.P2", "IV.P3") GG614 <- melt(GG614.in, id=1) GG614$Rep <- rep(c("I","II","III","IV"), each=24) GG614$GrowthStage <- factor(rep(c("P1","P2","P3"), each=8, times=4)) names(GG614)[3] <- "Nitrogen" GG614$Treatment <- factor(GG614$Treatment) GG614 ## plot the data interaction2wt(Nitrogen ~ Rep/Treatment + Treatment*GrowthStage, data=GG614) interaction2wt(Nitrogen ~ Treatment*GrowthStage, data=GG614, simple=TRUE) ## Table 6.16 GG614.aov <- aov(Nitrogen ~ Error(Rep/Treatment) + Treatment*GrowthStage, data=GG614) summary(GG614.aov) Treatment.contrasts <- ## 1 2 3 4 5 6 7 8 cbind("7-1234568" = c( 1, 1, 1, 1, 1, 1,-7, 1), "8-123456" = c( 1, 1, 1, 1, 1, 1, 0,-6), "25-1346" = c(-1, 2,-1,-1, 2,-1, 0, 0), "2-5" = c( 0, 1, 0, 0,-1, 0, 0, 0)) contrasts(GG614$Treatment) contrasts(GG614$Treatment) <- Treatment.contrasts contrasts(GG614$Treatment) ## Table 6.18 GG614.aov <- aov(Nitrogen ~ Error(Rep/Treatment) + Treatment*GrowthStage, data=GG614) summary(GG614.aov, expand.split=FALSE, split=list(Treatment=list( "7-1234568"=1, "8-123456"=2, "25-1346"=3, "2-5"=4, rest=c(5,6,7)), "Treatment:GrowthStage"=list( "7-1234568:P"=c(1,8), "8-123456:P"=c(2,9), "25-1346:P"=c(3,10), "2-5:P"=c(4,11), "rest:P"=c(5,6,7,12,13,14)) )) On Thu, May 9, 2013 at 7:58 AM, Lundrigan, Cyril <cyrillund...@gov.nl.ca> wrote: Hello I'm a new user of R and I'm using Deducer as the interface but also making use of the command interface where necessary. I'm trying to replicate Table 6.18 on page 262 in Statistical Procedures in Agricultural Research, by K. A. Gomez and A. A. Gomez. New York, Chichester, etc.: Wiley (1984). http://pdf.usaid.gov/pdf_docs/PNAAR208.pdf. This example is highly relevant to the type of data we will be analyzing in our department but nobody here has experience doing partitioning of interactions with software. I've managed to replicate all previous steps for that particular exercise up to this point. If I interpret the syntax correctly, the table is showing comparisons of specific treatment combinations within the time variable P. Is this the correct interpretation? If so, I don't know how to achieve that with R. I had initially used SYSTAT for this exercise and had sent the problem along to their support person and after a few days the response was that he did not understand the syntax and, thus, could not replicate the table results. Unfortunately, it's also one of the few Gomez and Gomez examples not covered in the "agridat" package. I was trying to do the partiioning with interactionMeans and testInteractions functions in phia package but made no headway. Greatly appreciate any help or direction with this. Thanks! "This email and any attached files are intended for the sole use of the primary and copied addressee(s) and may contain privileged and/or confidential information. Any distribution, use or copying by any means of this information is strictly prohibited. If you received this email in error, please delete it immediately and notify the sender." [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. âThis email and any attached files are intended for the sole use of the primary and copied addressee(s) and may contain privileged and/or confidential information. Any distribution, use or copying by any means of this information is strictly prohibited. If you received this email in error, please delete it immediately and notify the sender.â [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.