[R] TukeyHSD

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Fri Jan 31 16:12:09 CET 2003


You implicitly (probably) used na.omit on your dataset, and it added an
na.action attribute to the data frame.  Try not doing that (e.g. bu using
na.action = na.fail and search the archives for the same question about
model.tables).  Are there any missing values in your dataset? If so, you
should worry about balance (not that the numbers are inconsistent: 11
trials, 4 treatments on each replicated 3 times would seem to fit).

On Fri, 31 Jan 2003, C-G Pettersson wrote:

> Hello everybody!
> I´m working with a dataset from eleven field trails on barley 
> fertilization. I use R 1.6.2 (Windows)
> 
> It is quite easy to fit aov() objects to the dataset.
> The call:
> 
>  > (l1t4y.aov <- aov(Yield ~ Trial + Treatment, data=led1t4b))
> Results in an object with this anova table:
> 
>               Df    Sum Sq   Mean Sq F value    Pr(>F)
> Trial        10 121423585  12142358  63.499 < 2.2e-16 ***
> Treatment     3  15252804   5084268  26.589 3.288e-13 ***
> Residuals   118  22564015    191220
> 
> which is in line with what I know about the data.
> 
> When I then try to look at the treatment contrasts with an approach as near 
> as possible to pp178-181 in MASS, the following happens:
> 
>  > (l1t4y.tk <- TukeyHSD(l1t4y.aov, which = "Treatment"))
> Error in replications(paste("~", paste(names(tables), collapse = "+")),  :
>          na.action must be a function
> 
> What have I done wrong, and what does the error message mean? There are no 
> empty cells in the "Treatment" column. The TukeyHSD call works fine with 
> the "immer" and "oats" datasets from MASS.

-- 
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




More information about the R-help mailing list