[R] Tukey HSD not working
Peter Ehlers
ehlers at ucalgary.ca
Sun Dec 12 21:08:28 CET 2010
On 2010-12-12 10:21, PGZC wrote:
>
> Drug US1 US2 Aptecha
> Celebrex 235.54 269.99 121.02
> Detrol LA 157.99 190.99 55.3
> Flomax 166.00 190.99 93.45
>
> Lipitor 174.99 200.99 137.7
>
> Novaldex 108.6 129.99 22.48
>
> Norvasc 186.66 203.99 161.93
> Plavix 107.99 106.99 64.53
> Prevacid 117.39 134.99 59.83
> Prilosec 115.99 126.99 57.75
> Zyrtec 181.1 200.99 58.79
>
> US1=c(235.54,157.99,166,174.99,108.60,186.66,107.99,117.39,115.99,181.10)
> US2=c(269.99,190.99,190.99,200.99,129.99,203.99,106.99,134.99,126.99,200.99)
> Aptecha=c(121.02,55.30,93.45,137.70,22.48,161.93,64.53,59.83,57.75,58.79)
> y=c(US1,US2,Aptecha)
> n=rep(10,3)
> group=rep(1:3,n)
> data = data.frame(y = y, group = factor(group))
> fit = lm(y ~ group, data)
> anova(fit)
> summary (fit)
>
The following did appear on that infernal Nabble list but for
some reason did not make it to my mail reader:
> my problem is that ive been trying to do TukeyHSD on this
> and an error comes up it cant find or use fit, data, group, etc
It would seem obvious that you should include just what
"do TukeyHSD on this" means in your world, i.e. what *code*
did you use? It would also make *really* good sense to
quote the exact error message, which I divine to be:
Error in UseMethod("TukeyHSD") :
no applicable method for 'TukeyHSD' applied to an object of class "lm"
and which further would seem to be pretty self-explanatory
especially in light of this from the help page:
x A fitted model object, usually an aov fit.
So why not try an *aov* fit? Works for me.
Peter Ehlers
More information about the R-help
mailing list