[R] Extracting variance components in lme

Simon Blomberg blomsp at ozemail.com.au
Thu Nov 3 01:52:51 CET 2005


v <- VarCorr(fm1Rail.lme)

str(v) # get an idea of how v is structured. This suggests:

 > as.numeric(v[1, 2])
[1] 24.80547

There may be easier and better ways....

HTH,

Simon.


At 11:02 AM 3/11/2005, you wrote:
>Consider the output for the inroductory "Rail" example in "Mixed Effects
>Models in S and S-PLUS" by Pinheiro and Bates:
>
>  > summary(fm1Rail.lme)
>Linear mixed-effects model fit by REML
>   Data: Rail
>        AIC      BIC   logLik
>    128.177 130.6766 -61.0885
>
>Random effects:
>   Formula: ~1 | Rail
>          (Intercept) Residual
>StdDev:    24.80547 4.020779
>
>Fixed effects: travel ~ 1
>              Value Std.Error DF  t-value p-value
>(Intercept)  66.5  10.17104 12 6.538173       0
>
>Standardized Within-Group Residuals:
>          Min          Q1         Med          Q3         Max
>-1.61882658 -0.28217671  0.03569328  0.21955784  1.61437744
>
>Number of Observations: 18
>Number of Groups: 6
>
>
>I want to extract the variance components  sigma = 4.020779 (the within
>component) and sigma_b = 24.80547 (the between component).
>
>I can get sigma easily:
>sigma <-  fm1Rail.lme$sigma
>
>but how can I get sigma_b ?
>
>Cheers,  Murray Jorgensen
>
>--
>Dr Murray Jorgensen      http://www.stats.waikato.ac.nz/Staff/maj.html
>Department of Statistics, University of Waikato, Hamilton, New Zealand
>Email: maj at waikato.ac.nz                                Fax 7 838 4155
>Phone  +64 7 838 4773 wk    Home +64 7 825 0441    Mobile 021 1395 862
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list