[R] SAS "/slice" and "/diff" equivalent? - Automated multiple comparisons in nlme package?

Daniel Pereira danielreispereira at gmail.com
Mon Dec 13 07:08:36 CET 2010


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



More information about the R-help mailing list