[R-sig-ME] sas to R

Joshua Wiley jwiley.psych at gmail.com
Mon Jun 25 17:04:19 CEST 2012


Hi Steve,

That SAS code looks a little strange to me (I feel like it is missing
a distribution and some options on the random line).  It would
probably help if you could also describe in words what you are doing
or trying to do.

a rough pass at it would be:

glmer(y ~ trt + (trt | block) + (trt | trial), data = df, family = "binomial")

That will fit a logistic model, with a random intercept and trt effect
by block and by trial.  If they are nested, that is fine.  If they are
cross classified, that is fine too.  The random intercept and trt
effect will be correlated by default.

Cheers,

Josh

On Mon, Jun 25, 2012 at 7:50 AM, Steve Hong <emptican at gmail.com> wrote:
> Dear all,
>
> Can anyone help me convert SAS code to R in lme or lmer, especially in
> random statement part?
>
> Here is SAS code:
> proc glimmix data=df;
> class trial block trt;
> model y=trt;
> random trial block(trial) trt(block*trial);
>
> Thanks in advance,
>
> Steve
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/



More information about the R-sig-mixed-models mailing list