[R] (no subject)

Ista Zahn izahn at psych.rochester.edu
Wed Oct 27 17:13:51 CEST 2010


Hi Timothy,
Look at the help page for multcompLetters, especially the examples to
see what the function expects the input to look like:
?multcompLetters
example(multcompLetters)

Then look at the structure of kr:
str(kr)
and notice that the the logical vector you need is in the column named
"difference" in the dif.com data.frame. Extract those values and
format as required for multcompLetters
kr.diff <- kr$dif.com$difference
names(kr.diff) <- rownames(kr$dif.com)
Then run multcompLetters:
multcompLetters(kr.diff)

HTH,
Ista
On Wed, Oct 27, 2010 at 2:27 PM, Timothy Spier <timspier at hotmail.com> wrote:
>
> I am interested in using "multcompLetters" after running "kruskalmc" but
> I'm a newbie and I'm not having luck figuring it out. I can run "kruskalmc" just fine,
> but after studying the documentation for "multcompletters" for a long time,
> I cannot figure out how to make it work. Any ideas? R input is below
>>
>>> #here is my data set
>>> tst
>>     Month Food_kg
>> 1    Feb     4.7
>> 2    Feb     4.9
>> 3    Feb     5.0
>> 4    Feb     4.8
>> 5    Feb     4.7
>> 6    May     4.6
>> 7    May     4.4
>> 8    May     4.3
>> 9    May     4.4
>> 10   May     4.1
>> 11   May     4.2
>> 12   Aug     4.8
>> 13   Aug     4.7
>> 14   Aug     4.6
>> 15   Aug     4.4
>> 16   Aug     4.7
>> 17   Aug     4.8
>> 18   Nov     4.9
>> 19   Nov     5.2
>> 20   Nov     5.4
>> 21   Nov     5.1
>> 22   Nov     5.6
>>> #run the KW test
>>> k = kruskal.test(Food_kg, Month)
>>> k
>>          Kruskal-Wallis rank sum test
>>
>> data:  Food_kg and Month
>> Kruskal-Wallis chi-squared = 17.2561, df = 3, p-value = 0.000626
>>
>>> #run the kruskalmc
>>> kr = kruskalmc(Food_kg, Month)
>>> kr
>> Multiple comparison test after Kruskal-Wallis
>> p.value: 0.05
>> Comparisons
>>            obs.dif critical.dif difference
>> Aug-Feb  3.650000    10.373791      FALSE
>> Aug-May  6.333333     9.891022      FALSE
>> Aug-Nov  9.450000    10.373791      FALSE
>> Feb-May  9.983333    10.373791      FALSE
>> Feb-Nov  5.800000    10.835071      FALSE
>> May-Nov 15.783333    10.373791       TRUE
>
>
>>> #now I want to run multcompLetters but I'm stuck
>>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list