# [R] problem in R for Linear mixed model~

Daniel Malter daniel at umd.edu
Mon Jun 23 04:22:46 CEST 2008

```Hi,

random=~1|B/C
C is nested in B

##Example
data=Oats
regress=lme(yield~nitro*Variety,data=Oats,random=~1|Block/Variety)
##i.e. variety is nested in block
summary(regress)
##End of example

Best,
Daniel

-------------------------
cuncta stricte discussurus
-------------------------

-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von Manli Yan
Gesendet: Sunday, June 22, 2008 9:30 PM
An: r-help at r-project.org
Betreff: [R] problem in R for Linear mixed model~

Dear R users:
I just got confused some R code used in linear mixed model~
example,two factors,A, B,C,A is fixed ,B,C are random,and B is nested in
C,if I wannt to use linear mixed model,are the following code correct for
each case?
case1:want to know random effect of B,
case1<-lme(y~A*B*C,random=~B|C) where "B|C" stand for what?,mean B is
nested in C?

case2: how to wirte random effect of C?
case2<-lme(y~A*B*C,random=~C)? this doesnt work out,it seem it must have
somehing like #|\$

case3.omitting the random effect for B from case1
case3<-update(case1,random=~1|C),so I just type 1,so the random effect of
B will be removed from the model,there only left random effect of c ,the
random effect I removed ,which include both random intercept and slope
,correct??

case4:omitting the random  intercept
case4<-update(case1,random=B-1|C)
this code I got from some paper,it said by inputing B-1|C,then the random
intercept  is removed,so,if I want to remove random slode,I input B-2|C,it
doesnt work out.

case5 :how to know the both random effect of B,and C,I dont know how to
wirtie this in R .
And I am a little confused of these R code,especially the #|# part,what
deos this syntax really mean in LME package,