See the error message. Thanks. a.fit<-lme(distance~age, data=aaa, random=~day/subject) getVarCov(a.fit) Error in getVarCov.lme(a.fit) : Not implemented for multiple levels of nesting
On Wed, Sep 10, 2008 at 9:53 PM, Lyman, Mark <[EMAIL PROTECTED]> wrote: > Take a look again at help(getVarCov). > > > > Mark Lyman, Statistician > > ATK Launch Systems > > [EMAIL PROTECTED] > > *From:* huang min [mailto:[EMAIL PROTECTED] > *Sent:* Tuesday, September 09, 2008 10:02 PM > *To:* r-help@r-project.org > *Cc:* [EMAIL PROTECTED] > *Subject:* Re: extract variance components > > > > Hi, > > > > Thanks for all. I now know how to extract the \sigma's. > > For the unbalanced model y_{ijk}=x\beta+\alpha_i+\beta_{ij}+e_{ijk} > > i=1,2,\dots,a, j=1,2,\dots,b_i, k=1,2,\dots,n_{ij} > > > > How can I extract the variance matrix $V$? The variance for the ith group > is also of help. Suppose the ith group has totally 10 observations. b_i=4, > n_{i1}=1,n_{i2}=3,n_{i3}=2 and n_{i4}=1. $V_i=\sigma_a^2 J_{10}+\sigma_b^2 > diag(J_1,J_3,J_2, J_1)+\sigma_e^2 I_{10}$, where I is the identity matrix > and J_d is the matrix of 1's with dimention d \by d. J_d reduces to 1 if > d=1. I only know how to extract the design matrix for the fixed effect by > model.matrix(lme.fit2). How to deal with the parts for the random effects? > Thank you. > > > > Huang > > > > > > > On Fri, Aug 29, 2008 at 11:30 AM, huang min <[EMAIL PROTECTED]> wrote: > > HI, > > > > I would like to extract the variance components estimation in lme function > like > > > > a.fit<-lme(distance~age, data=aaa, random=~day/subject) > > > > There should be three variances \sigma_day, \sigma_{day %in% subject } and > \sigma_e. > > > > I can extract the \sigma_e using something like a.fit$var. However, I > cannot manage to extract the first two variance components. I can only see > the results in summary(a.fit). > > > > I have some problem in the lme4 package and hence use the nlme package. The > example data also has some problem so I just list the function here using > some imaginary data set. Thank you. > > > > Huang > > > [[alternative HTML version deleted]] ______________________________________________ R-help@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.