[R] Dunnett Test in 'multicomp' package

Jim Lemon drjimlemon at gmail.com
Fri Jun 5 01:08:49 CEST 2015


Hi James,
You can change the order of levels like this:

levels(viagraData$dose)<-c("placebo","low dose","high dose")

Although I don't know the exact names of the variable and its levels.

Jim

On Fri, Jun 5, 2015 at 7:19 AM, Richard M. Heiberger <rmh at temple.edu> wrote:
> This example is based on ?glht
>
>> data(warpbreaks)
>> glht(amod, linfct = mcp(tension = "Dunnett"))
>
> General Linear Hypotheses
>
> Multiple Comparisons of Means: Dunnett Contrasts
>
>
> Linear Hypotheses:
>            Estimate
> M - L == 0    -10.0
> H - L == 0    -14.7
>> levels(warpbreaks$tension)
> [1] "L" "M" "H"
>> warpbreaks$tension <- factor(warpbreaks$tension, levels=c("H","M","L"))
>>        amod <- aov(breaks ~ tension, data = warpbreaks)
>> glht(amod, linfct = mcp(tension = "Dunnett"))
>
> General Linear Hypotheses
>
> Multiple Comparisons of Means: Dunnett Contrasts
>
>
> Linear Hypotheses:
>            Estimate
> M - H == 0     4.72
> L - H == 0    14.72
>
>
> Changing the order of the levels is easy.  Rearranging the data itself
> is not necessary.
>
> Rich
>
> On Thu, Jun 4, 2015 at 3:42 PM, James F. Henson
> <james_henson at suagcenter.com> wrote:
>> Greetings
>>
>> Below is my code.
>>
>> library("multcomp")
>> viaModel1 <- aov(libido ~ dose, data=viagraData)
>> dunnettModel <- glht(viaModel1 , linfct = mcp(dose = "Dunnett"), base = "placebo")
>>
>> The code base="placebo" is ignored.  All treatments are compared to the first treatment in the order, which is "high dose".  It is possible to rearrange the order so that "placebo' is first, but this is inconvenient.
>>
>> Thanks,
>> James F. Henson
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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 at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list