Dunnett all-to-control test in R

OK, it is going to be a first of series of blog entries on my struggle with [tag]R project[/tag]. I consider myself an amateur in statistics and in R, so they are going to be without any theoretical background and discussions of the math underneath the stuff I am going to write about, so any comments are welcome.

Anyway, my task was to run [tag]Dunnett test[/tag] on set of data from some animal study. If it was my experiment, I would run one-way ANOVA and maybe happily discover some other relationships significant and were unable to make sense out of it in the paper. This time, not my project, and I was told Dunnett is all they need.

OK, thanks God for Google, I found nice article in R News from December 2002, where the stuff was quite well explained, read my data into R, one line of code:
simint (variable1~group, conf.level=0.95, alternative=’two.sided’

got my results and….disturbing:

Warning message:
‘simint.default’ is deprecated.
Use ‘glht’ instead.
See help(“Deprecated”) and help(“multcomp-deprecated”).

Great! In plain English, I just wasted my time discovering something that maybe next time I need to run same test won’t be there any more.

OK, count down from 150, and start looking for [tag]glht[/tag].

Of course, something I just minutes ago did in one line, now requires no less then three:

model <- aov(variable1~group)
results <- glht(model, linefc=mcp(group='Dunnett'), alternative='t' )
summary(results)

Maybe it is better though, as I got all significance levels at once.

This entry was posted in R project, University. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>