[R] R equivalent to `estimate' in SAS proc mixed

Randy Johnson rjohnson at ncifcrf.gov
Thu Aug 18 23:20:36 CEST 2005


Example: I have the following model

    > model <- lmer(response ~ time * trt * bio + (time|id), data = dat)

    where time = time of observation
           trt = treatment group (0-no treatment / 1-treated)
           bio = biological factor (0-absent / 1-present)

and I would like to obtain an estimate (with standard error) of the change
in response over time for individuals in the treatment group with the
biological factor. The estimate is easy,

    > sum(fixef(model)[c(2,5,6,8)])

    # ie time + time:trt + time:bio + time:trt:bio

but the standard error is a hassle to calculate by hand. Is there some
better way to do this? In SAS for example there is an `estimate' option (see
sample code below) that will calculate the estimate, SE, df, t statistic,
etc... Is there some R equivalent?

Thanks,
Randy


proc mixed data=dat;
  class id;
  model response = time + trt + bio + time*trt + time*bio + trt*bio +
                   time*trt*bio;
  random time;

  estimate "est1" intercept 0 time 1 trt 0 bio 0 time*trt 1 time*bio 1
                  trt*bio 0 time*trt*bio 1;  /* or something like that */
run;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Randy Johnson
Laboratory of Genomic Diversity
NCI-Frederick
Bldg 560, Rm 11-85
Frederick, MD 21702
(301)846-1304
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




More information about the R-help mailing list