Re: [R] Nested variance-covariance matrix in Multilevel model

From: Spencer Graves <>
Date: Fri 23 Jun 2006 - 13:22:03 EST

          What's your error message? I see a syntax error in

random=list(Probe=pdBlocked(list(~1,pdCompSymm(~1 ),End=~1,ProbeNo=pdCompSymm(~1))

          I count 5 open parens and 3 close parens. I know that might have been part of what you copied into this email and not what you gave R. However, it sounds like you have several problems.

          Have you seen Pinheiro and Bates (2000) Mixed-effects models in S and S-PLUS (Springer)? This is the premier (almost mandatory) reference for 'lme'. Moreover, the "~\library\nlme\scripts" subdirectory of the R installation directory (at least under Windows) contains files "ch01.R", "ch02.R", ..., "ch06.R", "ch08.R" containing essentially all the S commands used in the book, organized by chapter. This can save endless hassles with spelling problems (and minor syntax differences between S-Plus and R). Sections 1.5 and 1.6, pp. 40-72, discuss analyses if two different nested experiments.

          If just want a standard nested analysis, this should be adequate. If you have other special things happening that I missed in skimming your email, please explain why the analyses described in Pinheiro and Bates do you apply. In doing so, please include a simple, self-contained example showing what you tried and why you think it's not adequate. Please don't send us a megabyte of data. Instead, please either (a) modify an example from the book or some other R documentation or (b) generate phony data with a very few lines of R code.

	  Hope this helps.
	  Spencer Graves

Tobias Guennel wrote:
 > I completely forgot to supply the R code I tried:  >
vov1i2<-read.table("VOV1_INHIBITED6-16-2006-13h35min33sec.txt",header=TRUE)  >

 > ),End=~1,ProbeNo=pdCompSymm(~1)),data=vov1i2)
 > It doesn't look right to me and it produces an error too.
 > It should be something around those lines though.
 > Tobias Guennel

Tobias Guennel wrote:
> Dear R community,
> I have trouble implementing a nested variance-covariance matrix in the
> lme function.
> The model has two fixed effects called End and logpgc, the response
> variable is the logarithm to base 2 of Intensity ( log2(Intensity) )
> and the random effects are called Probe and ProbeNo.
> The model has the following nesting structure: A Pixel is nested within
> the ProbeNo,the ProbeNo is within the ProbeEnd ( there are two ends for
> every probe), and the ProbeEnd is within the Probe.
> Now the problem I have is that the variance-covariance structure of the
> model is quite complex and I can not find the right syntax for fitting
> it in the lme function.
> The variance-covariance structure is a block diagonal matrix of the form,
> V1 0 0
> V= 0 V2 0
> 0 0 V3
> where V1...V3 are of the structure:
> v11 v12
> V1= and so on.
> v21 v22
> V1...V3 are assumed to have a compound symmetric variance-covariance
> structure and therefore the submatrices are of the form:
> Lambda Delta1 Delta1 ... Delta1
> Delta1 Lambda Delta1 ... Delta1
> v11=v22= .......
> Delta1 ..... Lambda
> Delta2 Delta2 Delta2 ... Delta2
> Delta2 Delta2 Delta2 ... Delta2
> v12=v21= .......
> Delta2 ..... Delta2
> The elements of these submatrices depend only upon the three covariance
> parameters: the compound symmetry parameter delta; the variance of
> random effect sigma^2g; and the residual variance sigma^2. I have
> formulas for the submatrices Lambda,Delta1 and Delta2 which I can't
> really paste in here.
> The SAS code dealing with this model is the following:
> proc mixed data=rnadeg.pnau;
> title 'CV structure for PNAU';
> class probepos probeno end probe pixelid newprobeid;
> model logPM=end logpgc / ddfm=satterth;
> random probeno newprobeid / subject=probe type=cs;
> lsmeans end / diff cl; run;
> Any ideas are appreciated a lot since I am kind of stuck at this point.
> Thank you
> Tobias Guennel
> ______________________________________________
> mailing list
> PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Fri Jun 23 13:28:10 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 23 Jun 2006 - 14:12:37 EST.

Mailing list information is available at Please read the posting guide before posting to the list.