[R] Getting intervals for within-group standard errors for each group using nlme and varIdent
Greg Snow
Greg.Snow at intermountainmail.org
Mon Oct 8 22:40:36 CEST 2007
Just to follow-up on this for the archive and anyone else who is
interested in this problem. I ended up solving this by running lme
seperately on subsets of the data (one for group=='A' and one for
group=='B'), the intervals for the statistics computed both ways were
within rounding of each other, so I felt confident in using the standard
deviation estimate from the "A" only subset group.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Greg Snow
> Sent: Thursday, September 27, 2007 12:20 PM
> To: r-help at r-project.org
> Subject: [R] Getting intervals for within-group standard
> errors for each group using nlme and varIdent
>
> I am using lme from the nlme package to fit a mixed model.
> We have observations nested in patients(encounters) and
> patients nested in groups (2 different treatments). We are
> interested in the differences between the 2 groups, both the
> means and the standard deviations (are patients in group A
> less variable than those in group B? both within patient and
> between patient within group).
>
> Here is the call from my lme object:
>
> > fit3$call
> lme.formula(fixed = BG ~ group, data = bg, random =
> list(Encounter = pdDiag(~group -
> 1)), weights = varIdent(form = ~1 | group))
>
> then I call the intervals function:
>
> Approximate 95% confidence intervals
> Fixed effects:
> lower est. upper
> (Intercept) 123.40005 126.88445 130.36885
> groupB 17.44991 23.60049 29.75107
> attr(,"label")
> [1] "Fixed effects:"
> Random Effects:
> Level: Encounter
> lower est. upper
> sd(groupA) 16.62769 19.13351 22.01698
> sd(groupB) 24.01774 27.63703 31.80171
> Variance function:
> lower est. upper
> A 0.8270135 0.8534733 0.8807797
> attr(,"label")
> [1] "Variance function:"
> Within-group standard error:
> lower est. upper
> 33.56082 34.29237 35.03987
>
> and this gives me most of what I want, the only exception is
> that I (actully my client) want the interval for the
> Within-group standard error of group A (the last interval
> shows it for group B and the Variance function shows the
> interval for their ratio).
>
> Any suggestions?
>
> Thanks,
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list