[R-sig-ME] VarIdent, extracting delta value
Peter Dalgaard
P.Dalgaard at biostat.ku.dk
Thu Aug 27 17:02:30 CEST 2009
Afshartous, David wrote:
> All,
>
> When using varIdent to specify different residual error variance per strata,
> one obtains the ratio between the standard deviations of the strata (see P&B
> p.211), and this is included in the summary output. However, perhaps I'm
> missing something extremely basic but I don't see where this is within
> str((summary(m1)) for a given model and hence cannot extract it. A
> workaround is below, but if anyone knows the direct method please advise.
>
> Cheers,
> David
>
>
> Library("nlme")
> m1 = lme(distance ~ age, random = ~ 1 | Subject, weights = varIdent(form =
> ~ 1 | Sex), data = Orthodont)
> summary(m1)
> ## shows that delta = 0.4533690
> ##
> Variance function:
> Structure: Different standard deviations per stratum
> Formula: ~1 | Sex
> Parameter estimates:
> Male Female
> 1.0000000 0.4533690
>
> ##
> str(summary(m1))
>
> ## workaround:
> 1/attr(m1$modelStruct[[2]], "weights")[100]
> Female
> 0.4533690
>
I think the canonical way is
> exp(c(summary(m1)$modelStruct$varStruct))
[1] 0.4533690
or
> coef(m1$modelStruct$varStruct, unconstrained=FALSE, allCoef=TRUE)
Male Female
1.0000000 0.4533690
I'm not really sure that there is not a neater way of drilling down to
m1$modelStruct$varStruct
or summary(m1)$...
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-sig-mixed-models
mailing list