Skip to content

Tukey HSD not working

5 messages · Peter Ehlers, PGZC

#
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)
#
On 2010-12-12 10:21, PGZC wrote:
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
#
TukeyHSD(fit)
Error in TukeyHSD(fit) : object 'fit' not found
Error in UseMethod("TukeyHSD") : 
  no applicable method for 'TukeyHSD' applied to an object of class
"function"
Error in UseMethod("TukeyHSD") : 
  no applicable method for 'TukeyHSD' applied to an object of class
"c('integer', 'numeric')"
Error in UseMethod("TukeyHSD") : 
  no applicable method for 'TukeyHSD' applied to an object of class
"c('double', 'numeric')"
Error in UseMethod("TukeyHSD") : 
  no applicable method for 'TukeyHSD' applied to an object of class
"function"
Error in UseMethod("TukeyHSD") : 
  no applicable method for 'TukeyHSD' applied to an object of class
"function"
#
TukeyHSD(fit)
Error in UseMethod("TukeyHSD") : 
  no applicable method for 'TukeyHSD' applied to an object of class "lm"
Error in UseMethod("TukeyHSD") : 
  no applicable method for 'TukeyHSD' applied to an object of class
"function"
Error in UseMethod("TukeyHSD") : 
  no applicable method for 'TukeyHSD' applied to an object of class
"c('integer', 'numeric')"
Error in UseMethod("TukeyHSD") : 
  no applicable method for 'TukeyHSD' applied to an object of class
"c('double', 'numeric')"
Error in UseMethod("TukeyHSD") : 
  no applicable method for 'TukeyHSD' applied to an object of class
"data.frame"
Error in UseMethod("TukeyHSD") : 
  no applicable method for 'TukeyHSD' applied to an object of class
"function"
#
On 2010-12-13 07:29, PGZC wrote:
Okay, the basic problem appears to be that
you know nothing about how to use R. Rather
than take a scattergun approach and throw
anything you can think of at the poor TukeyHSD
function, why not take the time to work your
way through 'An Introduction to R'? Or one
of the many intro documents found on the web.

(Normally, I would advise a careful reading
of the help page and liberal use of the str()
function, but it seems that your needs are more
basic.)

Peter Ehlers