Daniel Pereira
2010-Dec-13 06:08 UTC
[R] SAS "/slice" and "/diff" equivalent? - Automated multiple comparisons in nlme package?
R users, What is the equivalent of SAS " '/diff' and '/slice'" in R ? I am successful in fitting the same model "PROC MIXED" fits using lme() : ###R code: model <- lme( y ~ g + h + yr + yr:h, random = ~ 1 | b, data = yield) *** SAS code: proc mixed data=yield covtest cl method=reml; class b g h yr; model y = g h yr yr*h; random b; lsmeans g / diff; The codes above give equivalent outputs (analysis of a 5(g) by 2(h) factorial, RCBD(b)), except for the "lsmeans g / diff" line, which I cannot reproduce in R! The below gives one of the comparisons I am looking for. anova(model, L=c("gPEN"=1, "gC5"=-1)) Is there a command to automate such thing? I understand from https://stat.ethz.ch/pipermail/r-help/2007-March/128151.html and https://stat.ethz.ch/pipermail/r-help/2004-February/046684.html the issues with "lsmeans" (this is *not* what I am trying to get here! ). I am just trying to get all possible pairwise comparisons from one simple command. Already checked the "effects package" but it did not work with a lme() object. Thanks in advance, Daniel