[R] nested hierarchical design

Jelmer Elzinga JelmerAnne.Elzinga at unil.ch
Tue Jan 16 18:00:41 CET 2007


Dear R-Helpers,

I would like to know what syntax I need to use to do a nested anova for 
1. a continuous variable and 2. count data (x out of y)
1. The first I used to do in SPSS and I would like to be able to do it 
in R as well.
This is the hierarchical model I would like to use: a continuous 
variable explained by factor A(fixed) + factor B(random) nested in A + 
factor C (random) nested in factor B (which is nested in A).
The data is unbalanced at all levels, meaning different nrs of B per A, 
different nrs of C for B, different nrs of values per C
In SPSS this seems to be quite simple with a small writing in the syntax 
(see below). But how do I get the same results in R with lme?

SPSS syntax:
UNIANOVA
  var  BY A B C
  /RANDOM = B C
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
  /CRITERIA = ALPHA(.05)
  /DESIGN = A B(A) C(B(A))).

2. the same model but than for count data (like 15 out of 30, 23 out of 
60) instead of the continous variable(I know the basics of glm in R)

Thanks a lot for your help
Jelmer



More information about the R-help mailing list