Dear R developers and users: 
     
I have the following data, x is the response vaiable, nsample(individual) nested within trt, and subsample nested within nsample, I want to fit trt as fixed effect, and block, nsample(trt) as random effects using lme, is the following coding correct?

dat$vgrp <- getGroups(dat, form = ~ 1|trt/nsample, level = 2)

ge.lme1 <- lme(fixed=x~trt, data=dat, random=~ block + nsample|vgrp)



      x block trt nsample subsample 
      -0.68984 1 1 1 1 
      -0.2223 2 1 1 2 
      -1.00144 3 1 2 1 
      -2.59511 4 1 2 2 
      2.51573 5 1 3 1 
      -1.67577 6 1 3 2 
      -0.31927 7 1 4 1 
      -3.28983 8 1 4 2 
      0.04243 9 1 5 1 
      -0.00635 10 1 5 2 
      -0.09925 11 1 6 1 
      -0.73825 12 1 6 2 
      -0.64498 13 1 7 1 
      -2.35105 14 1 7 2 
      1.13354 15 1 8 1 
      -1.45652 16 1 8 2 
      -0.05577 17 1 9 1 
      -3.46945 18 1 9 2 
      -0.16415 19 1 10 1 
      -3.31346 20 1 10 2 
      -1.67036 1 2 1 1 
      -2.28084 2 2 1 2 
      -0.4165 3 2 2 1 
      -0.51967 4 2 2 2 
      -1.20591 5 2 3 1 
      -1.33746 6 2 3 2 
      2.40848 7 2 4 1 
      3.7884 8 2 4 2 
      1.14388 9 2 5 1 
      0.45225 10 2 5 2 
      -0.5008 11 2 6 1 
      -1.66627 12 2 6 2 
      0.97082 13 2 7 1 
      -0.14259 14 2 7 2 
      -2.14964 15 2 8 1 
      -1.77236 16 2 8 2 
      -0.0305 17 2 9 1 
      -1.23726 18 2 9 2 
      0.43089 19 2 10 1 
      1.07422 20 2 10 2 


Thanks,

Caimiao
	[[alternative HTML version deleted]]


