[R] TukeyHSD no longer working with aov output?
I can prove I've done this before, but I recently installed Rexcel (and it was easiest to reinstall R and some other bits to make it work) and now its no longer working. Before I would do an ANOVA and a tukey post-hoc like this: data1.aov=aov(result~factor1*factor2, data=data1) then... TukeyHSD(summary(data1.aov)) and it would give me a nice tukey table of all the pairwise comparisons, now though it gives me: in UseMethod(TukeyHSD) : no applicable method for TukeyHSD Has something changed? Does TukeyHSD no longer accept aov results? Is there a package I'm missing? I am very frustrated. Thanks, Clayton [[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.
Re: [R] TukeyHSD no longer working with aov output?
Hi Clayton, I don't think you need summary(). TukeyHSD(data1.aov) should work. -Ista On Tue, Oct 20, 2009 at 4:17 PM, Clayton Coffman clayton.coff...@gmail.com wrote: I can prove I've done this before, but I recently installed Rexcel (and it was easiest to reinstall R and some other bits to make it work) and now its no longer working. Before I would do an ANOVA and a tukey post-hoc like this: data1.aov=aov(result~factor1*factor2, data=data1) then... TukeyHSD(summary(data1.aov)) and it would give me a nice tukey table of all the pairwise comparisons, now though it gives me: in UseMethod(TukeyHSD) : no applicable method for TukeyHSD Has something changed? Does TukeyHSD no longer accept aov results? Is there a package I'm missing? I am very frustrated. Thanks, Clayton [[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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ 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.
Re: [R] TukeyHSD no longer working with aov output?
I've tried that as well, and I get an error like: TukeyHSD(phenolic.aov) Error in rep.int(n, length(means)) : unimplemented type 'NULL' in 'rep' In addition: Warning messages: 1: In replications(paste(~, xx), data = mf) : non-factors ignored: time 2: In replications(paste(~, xx), data = mf) : non-factors ignored: sink.status, time 3: In replications(paste(~, xx), data = mf) : non-factors ignored: time, cat 4: In replications(paste(~, xx), data = mf) : non-factors ignored: sink.status, time, cat however, I think its a problem with my data, something about how Rexcel imported it, becuase when I do it on the example data in the HSAUR package, it works I'll try importing the data manually. On Tue, Oct 20, 2009 at 3:33 PM, Ista Zahn istaz...@gmail.com wrote: Hi Clayton, I don't think you need summary(). TukeyHSD(data1.aov) should work. -Ista On Tue, Oct 20, 2009 at 4:17 PM, Clayton Coffman clayton.coff...@gmail.comhttps://mail.google.com/mail?view=cmtf=0to=clayton.coff...@gmail.com wrote: I can prove I've done this before, but I recently installed Rexcel (and it was easiest to reinstall R and some other bits to make it work) and now its no longer working. Before I would do an ANOVA and a tukey post-hoc like this: data1.aov=aov(result~factor1*factor2, data=data1) then... TukeyHSD(summary(data1.aov)) and it would give me a nice tukey table of all the pairwise comparisons, now though it gives me: in UseMethod(TukeyHSD) : no applicable method for TukeyHSD Has something changed? Does TukeyHSD no longer accept aov results? Is there a package I'm missing? I am very frustrated. Thanks, Clayton [[alternative HTML version deleted]] __ R-help@r-project.orghttps://mail.google.com/mail?view=cmtf=0to=r-h...@r-project.orgmailing 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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org [[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.
Re: [R] TukeyHSD no longer working with aov output?
Problem solved: Lesson learned (I think): TukeyHSD doesn't like it when you use numbers as names for the factors. ie factor time cannot be 24 and 48 but twenty-four and forty-eight work fine. On Tue, Oct 20, 2009 at 5:36 PM, Clayton Coffman clayton.coff...@gmail.comwrote: I've tried that as well, and I get an error like: TukeyHSD(phenolic.aov) Error in rep.int(n, length(means)) : unimplemented type 'NULL' in 'rep' In addition: Warning messages: 1: In replications(paste(~, xx), data = mf) : non-factors ignored: time 2: In replications(paste(~, xx), data = mf) : non-factors ignored: sink.status, time 3: In replications(paste(~, xx), data = mf) : non-factors ignored: time, cat 4: In replications(paste(~, xx), data = mf) : non-factors ignored: sink.status, time, cat however, I think its a problem with my data, something about how Rexcel imported it, becuase when I do it on the example data in the HSAUR package, it works I'll try importing the data manually. On Tue, Oct 20, 2009 at 3:33 PM, Ista Zahn istaz...@gmail.comhttps://mail.google.com/mail?view=cmtf=0to=istaz...@gmail.com wrote: Hi Clayton, I don't think you need summary(). TukeyHSD(data1.aov) should work. -Ista On Tue, Oct 20, 2009 at 4:17 PM, Clayton Coffman clayton.coff...@gmail.comhttps://mail.google.com/mail?view=cmtf=0to=clayton.coff...@gmail.com wrote: I can prove I've done this before, but I recently installed Rexcel (and it was easiest to reinstall R and some other bits to make it work) and now its no longer working. Before I would do an ANOVA and a tukey post-hoc like this: data1.aov=aov(result~factor1*factor2, data=data1) then... TukeyHSD(summary(data1.aov)) and it would give me a nice tukey table of all the pairwise comparisons, now though it gives me: in UseMethod(TukeyHSD) : no applicable method for TukeyHSD Has something changed? Does TukeyHSD no longer accept aov results? Is there a package I'm missing? I am very frustrated. Thanks, Clayton [[alternative HTML version deleted]] __ R-help@r-project.orghttps://mail.google.com/mail?view=cmtf=0to=r-h...@r-project.orgmailing 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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org [[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.
Re: [R] TukeyHSD no longer working with aov output?
I think its a problem with my data, something about how Rexcel imported it We don't have enough information to be sure. My guess is that your data in Excel is integers which are intended to be levels of a factor. Excel doesn't distinguish between integers and integers that might be factor levels. This is an Excel issue, not an RExcel issue. When you sent your data to R outside of RExcel, what did you do to force the levels to be interpreted as factors. Something similar must be done when you send the data to R from within RExcel. __ 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.
Re: [R] TukeyHSD no longer working with aov output?
interesting to know, that might explain it. When I imported I just saved as CSV and imported with read.csv, I've never done anything to specify the integers as factors (this is the first time I've used numbers as names). Here are the precise commands I use(d): phen=read.csv(file=phenolics.csv) phen.aov=aov(phenolics~sink*time*cat, data=phen) summary(phen.aov) Df Sum Sq Mean Sq F valuePr(F) sink2 1817.79 908.89 59.5934 2.2e-16 *** time1 19.07 19.07 1.2501 0.265039 cat 1 125.95 125.95 8.2581 0.004548 ** sink:time 2 12.026.01 0.3942 0.674834 sink:cat2 305.68 152.84 10.0213 7.493e-05 *** time:cat1 106.53 106.53 6.9849 0.008949 ** sink:time:cat 24.222.11 0.1384 0.870867 Residuals 179 2730.03 15.25 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 1 observation deleted due to missingness TukeyHSD(phen.aov) Tukey multiple comparisons of means 95% family-wise confidence level Fit: aov(formula = phenolics ~ sink * time * cat, data = phen) $sink diff lwr upr p adj Cut-Bolted -0.3491591 -1.980764 1.282446 0.8686316 Veg-Bolted 6.3800257 4.741959 8.018092 0.000 Veg-Cut 6.7291848 5.091118 8.367252 0.000 $time ...etc. I can see how the data format of the cell in Excel might confuse R if you imported it as an .xls file, or used Rexcel, thats avoided by using .csv. Whats interesting is that the aov function has no problem determining the levels of the factor be they integers or text, TukeyHSD doesn't like it though. When I did the summary(aov) with the data formatted such that it would not go into TukeyHSD it was imported with read.csv, but it had numbers/integers as the factor levels. TukeyHSD didn't work. When I reformatted those numbers to text (ie 24 to twenty-four), TukeyHSD worked fine. I assume it has something to do with how aov and TukeyHSD determine factor levels, aov may see anything in the specified factor-vectors as characters, whereas TukeyHSD will read integers as integers and get confused. On Tue, Oct 20, 2009 at 5:50 PM, Richard M. Heiberger r...@temple.eduwrote: I think its a problem with my data, something about how Rexcel imported it We don't have enough information to be sure. My guess is that your data in Excel is integers which are intended to be levels of a factor. Excel doesn't distinguish between integers and integers that might be factor levels. This is an Excel issue, not an RExcel issue. When you sent your data to R outside of RExcel, what did you do to force the levels to be interpreted as factors. Something similar must be done when you send the data to R from within RExcel. [[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.
Re: [R] TukeyHSD no longer working with aov output?
Now I am worried that you have a wrong analysis. the aov function is perfectly happy using either factors or numeric variables. Are there really only two levels of time, which is what one degree of freedom for time suggests? Or are there more than two level, but since aov() sees that as a numeric variable it has only one df. csv files can interfere with the interpretation of data values, but not likely in this case. They too will have numbers interpreted as numeric. __ 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.
Re: [R] TukeyHSD no longer working with aov output?
There are two factors of time, but they are evenly replicated across all the other factors/levels. The experiment is perfectly balanced except for one lost sample, which is deleted automatically in the aov. I am very certain the analysis is correct. I think its merely a discrepancy between how aov and TukeyHSD group the levels of the factor variable. Probably aov handles any vector specified as a character vector, whereas TukeyHSD merely assumes its a character vector. It might be something to refine in the stats package so the functions, which are designed somewhat to be used together, can work on the same kinds of data. On Tue, Oct 20, 2009 at 6:13 PM, Richard M. Heiberger r...@temple.eduwrote: Now I am worried that you have a wrong analysis. the aov function is perfectly happy using either factors or numeric variables. Are there really only two levels of time, which is what one degree of freedom for time suggests? Or are there more than two level, but since aov() sees that as a numeric variable it has only one df. csv files can interfere with the interpretation of data values, but not likely in this case. They too will have numbers interpreted as numeric. [[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.
Re: [R] TukeyHSD no longer working with aov output?
I think that Richard may be correct. In my experience it's always a bad idea to use numerical labels for factors, especially when importing data from Excel. But why not do a str() on your data to see whether R thinks that time is a factor or not? And if not, why not convert time to factor before passing it to aov()? I'm a bit uneasy over your use of the phrase there are two factors of time; that's not how most stats people would use the terminology and it may indicate a misunderstanding. You probably mean that there are two levels of the factor 'time'. Anyway, do str(your_data) and see what it says. -Peter Ehlers Clayton Coffman wrote: There are two factors of time, but they are evenly replicated across all the other factors/levels. The experiment is perfectly balanced except for one lost sample, which is deleted automatically in the aov. I am very certain the analysis is correct. I think its merely a discrepancy between how aov and TukeyHSD group the levels of the factor variable. Probably aov handles any vector specified as a character vector, whereas TukeyHSD merely assumes its a character vector. It might be something to refine in the stats package so the functions, which are designed somewhat to be used together, can work on the same kinds of data. On Tue, Oct 20, 2009 at 6:13 PM, Richard M. Heiberger r...@temple.eduwrote: Now I am worried that you have a wrong analysis. the aov function is perfectly happy using either factors or numeric variables. Are there really only two levels of time, which is what one degree of freedom for time suggests? Or are there more than two level, but since aov() sees that as a numeric variable it has only one df. csv files can interfere with the interpretation of data values, but not likely in this case. They too will have numbers interpreted as numeric. [[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. __ 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.