Felipe Martínez-Pastor
2006-Feb-15 12:39 UTC
[R] Pairwise comparison after repeated measures ANOVA
I am analyzing some data obtained after measuring some parameters at different times in samples obtained from many subjects. The model is quite simple: aov(parameter ~ Time + Error(Subject/Time)) Now I want to make a pairwise comparison between the levels of Time. However, I have not find how to do such a thing. I cannot use TukeyHSD or pairwise.t.test, I supposse. Maybe using contrasts? Could you aim me at some kind of information? All I have found is information on ANOVA, but not how to compare the levels of the factors afterwards. Maybe I simply do not understand how this really works, my background is not very deep in statistics. Thank you. Felipe --------------------oOo-------------------- Felipe Mart??nez Pastor, Ph. D. Ciencia y Tecnolog??a Agroforestal ETSIA-UCLM Av. Espa??a s/n 02071-Albacete (Spain) Phone: +34 967 599 200+2581 Fax: +34 967 599 238+2081 Mobile: +34 687 365 362 e-mail: Felipe.Martinez at uclm.es Jabber: felipe.martinez at jabberes.org website: http://www.germplasm.all.at -- Ning??n investigador sin contrato. Employment rights for Spanish junior researchers. http://www.precarios.org
Felipe Mart伱伃nez-Pastor <Felipe.Martinez <at> uclm.es> writes:> > I am analyzing some data obtained after measuring some parameters at > different times in samples obtained from many subjects. The model is > quite simple: aov(parameter ~ Time + Error(Subject/Time)) > > Now I want to make a pairwise comparison between the levels of Time. > However, I have not find how to do such a thing. I cannot use TukeyHSD > or pairwise.t.test, I supposse. Maybe using contrasts? >I would suggest that you use lme from package nlme for this type of a problem, because it provides a MUCH better toolbox fro what noadays is called mixed- effect models. And get the book by Pinheiro/Bates (Mixed-Effect Models in S and S-PLUS), which is full of practical examples of this type. With the results of <lme>, you can use <estimable> from package gmodels to estimate contrasts, and p.adjust to adjust for multiple comparison. However, as you parameter is called Time, you should really rethink if this is the right way to go. Why not treat Time as and continuous variable, effectively estimating a slope? Or at least as an ordered variable? I know from my clients that, after measuring a parameter 6 instances in time, they insist on a star- spangled list of all 15 pairwise comparisons. If they do, I take out Bonferroni's Iron Claw even if I know better methods. The question: "At what time intervals is the difference significant" is mostly nonsense. Try to rephrase as "Is there a significant linear trend in time?". Would adding a quadratic component improve the quality of the fit (use AIC for this, see Pinheiro/Bates or Venables/Ripley). In many biological applications I know, a linear trend is perfectly fine, and it often has an easy interpretation. You only have to fight "but it's not linear" faculty, who mostly would not object to computing the mean without ever thinking to ask "but it's not constant". Soapbox off. You see, I just had a discussion on the subject with a client. Dieter
Uwe Ligges
2006-Feb-16 07:27 UTC
[R] how can I write two objects together, problem with cbind()
Srinivas Iyyer wrote:> Hi Group, > I have two objects > 1. A data.frame with 2 columns > > Apple 4 > Boy 2 > Cat 5 > Dog 10 > Eel 9 > ... > Zebra 10 > (26 rows) > > I have another object which was obtained as vector of > integers with names as character. > > Fruit 10 > King 20 > Eel 19 > Boy 20 > Apple 15 > ... > (26 rows) > > Now I wanted to combine the two objects and wanted a > result that would look like this: > > Apple 4 15 > Boy 2 20 > Cat 5 28 > Dog 10 25 > Eel 9 19 > > > result <- cbind(obj1, obj2) > > My result is now jumbled: > > Apple 4 34 > Boy 2 21 > Cat 5 234 > Dog 10 23 > Eel 9 12 > > I want to write identical row names elements together. > > > What could be done here. Could any one please help me. >See ?merge Uwe Ligges> thanks > Srini > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html