Hello, I have a simple question about using the aov function syntax (ie. * + or :) for the interaction of 2 factors. I have read the help files, and researched other sites, and have included my source files. My goal is to measure the signifigance of the interaction between population and condition (aka. population:condition). I can't seem to figure it out. 1. In the first example the significance of population:condition works with the "allData" but not with the "studentData." Can you please explain why it fails and how I can fix it? 2. In the second example I can get the measure the significance of population:condition with 2 different methods, but I get 2 different results (using the "allData" source). Can you please explain why these Pr(>F) values are different? Thank you so much for your help!! Sincerely, Dave Deriso UCSD Psychiatry #Example 1 ---------------------------COPY & PASTE THE FOLLOWING #import the data allDataSource="http://files.davidderiso.com/r/allData.data" allData.import=read.table(allDataSource,header=T) studentDataSource="http://files.davidderiso.com/r/allData.data" studentData.import=read.table(studentDataSource,header=T) #aov for allData WORKS allData.integral.aov = aov(integral~population*condition, data=allData.import) summary(allData.integral.aov) #aov for studentData DOES NOT GIVE Pr(>F) of population:condition studentData.integral.aov = aov(integral~population*condition, data=studentData.import) summary(studentData.integral.aov) #Example 2 ---------------------------COPY & PASTE THE FOLLOWING #population:condition has a Pr(>F) of 0.96372 allData.integral.aov = aov(integral~population*condition, data=allData.import) summary(allData.integral.aov) #population:condition has a Pr(>F) of 1.070e-06 *** allData.integral.aov = aov(integral~population:condition, data=allData.import) summary(allData.integral.aov) [[alternative HTML version deleted]]
Oops small error Use this to import the data #import the data allData.import=read.table("http://files.davidderiso.com/r/allData.data ",header=T) studentData.import=read.table(" http://files.davidderiso.com/r/studentData.data",header=T) everything else is good On Sat, Jan 9, 2010 at 3:33 AM, Dave Deriso <dderiso@ucsd.edu> wrote:> Hello, > > I have a simple question about using the aov function syntax (ie. * + or :) > for the interaction of 2 factors. I have read the help files, and researched > other sites, and have included my source files. My goal is to measure the > signifigance of the interaction between population and condition (aka. > population:condition). I can't seem to figure it out. > > 1. In the first example the significance of population:condition works with > the "allData" but not with the "studentData." Can you please explain why it > fails and how I can fix it? > > 2. In the second example I can get the measure the significance of > population:condition with 2 different methods, but I get 2 different results > (using the "allData" source). Can you please explain why these Pr(>F) values > are different? > > Thank you so much for your help!! > > Sincerely, > > Dave Deriso > UCSD Psychiatry > > > #Example 1 ---------------------------COPY & PASTE THE FOLLOWING > > #import the data > allDataSource="http://files.davidderiso.com/r/allData.data" > allData.import=read.table(allDataSource,header=T) > studentDataSource="http://files.davidderiso.com/r/allData.data" > studentData.import=read.table(studentDataSource,header=T) > > > #aov for allData WORKS > allData.integral.aov = aov(integral~population*condition, > data=allData.import) > summary(allData.integral.aov) > > #aov for studentData DOES NOT GIVE Pr(>F) of population:condition > studentData.integral.aov = aov(integral~population*condition, > data=studentData.import) > summary(studentData.integral.aov) > > > > #Example 2 ---------------------------COPY & PASTE THE FOLLOWING > > #population:condition has a Pr(>F) of 0.96372 > allData.integral.aov = aov(integral~population*condition, > data=allData.import) > summary(allData.integral.aov) > > #population:condition has a Pr(>F) of 1.070e-06 *** > allData.integral.aov = aov(integral~population:condition, > data=allData.import) > summary(allData.integral.aov) >[[alternative HTML version deleted]]
What are you trying to do? Your example is not what is commonly called ANOVA (some call it ANCOVA) and more often lm() is used. I suspect that you intended 'population' to be a factor, and it is not. So population:condition is not an interaction but different slopes for population by levels of condition. population*condition expands to population + condition + population:condition and this is a larger model with different intercepts by levels of condition. I suggest you need study the primary reference (Chambers & Hastie 1992) or at least Bill Venables' exposition in MASS (the book, any edition). And note that you cannot test interactions in a two-way layout without replication, so perhaps you also need to talk to a statistician about ANOVA. BTW: I think you have messed up your first example: perhaps you meant studentDataSource="http://files.davidderiso.com/r/studentData.data" There are no P values in that example because there is no residual variation: the model fits exactly. On Sat, 9 Jan 2010, Dave Deriso wrote:> Hello, > > I have a simple question about using the aov function syntax (ie. * + or :) > for the interaction of 2 factors. I have read the help files, and researched > other sites, and have included my source files. My goal is to measure the > signifigance of the interaction between population and condition (aka. > population:condition). I can't seem to figure it out. > > 1. In the first example the significance of population:condition works with > the "allData" but not with the "studentData." Can you please explain why it > fails and how I can fix it? > > 2. In the second example I can get the measure the significance of > population:condition with 2 different methods, but I get 2 different results > (using the "allData" source). Can you please explain why these Pr(>F) values > are different? > > Thank you so much for your help!! > > Sincerely, > > Dave Deriso > UCSD Psychiatry > > > #Example 1 ---------------------------COPY & PASTE THE FOLLOWING > > #import the data > allDataSource="http://files.davidderiso.com/r/allData.data" > allData.import=read.table(allDataSource,header=T) > studentDataSource="http://files.davidderiso.com/r/allData.data" > studentData.import=read.table(studentDataSource,header=T) > > > #aov for allData WORKS > allData.integral.aov = aov(integral~population*condition, > data=allData.import) > summary(allData.integral.aov) > > #aov for studentData DOES NOT GIVE Pr(>F) of population:condition > studentData.integral.aov = aov(integral~population*condition, > data=studentData.import) > summary(studentData.integral.aov) > > > > #Example 2 ---------------------------COPY & PASTE THE FOLLOWING > > #population:condition has a Pr(>F) of 0.96372 > allData.integral.aov = aov(integral~population*condition, > data=allData.import) > summary(allData.integral.aov) > > #population:condition has a Pr(>F) of 1.070e-06 *** > allData.integral.aov = aov(integral~population:condition, > data=allData.import) > summary(allData.integral.aov) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595