# [R] orthogonal and nested model

Douglas Bates bates at stat.wisc.edu
Fri Dec 10 17:00:42 CET 1999

```Marcelo Martinez Palao <marmp at fcu.um.es> writes:

> I'm working with a orthogonal and nested model (mixed).
> I have  four factors, A,B,C,D;
> A and B are fixed and orthogonal
> C is nested in AB interaction
> and finally, D is nested in C.
>  I would like to model the following
> Y_ijklm=Mu+A_i+B_j+AB_ij+C_k(ij)+D_l(k(ij))+Error_m(...)
>
> I used the next command
>
> >summary(aov(abund~A*B + C % in % A:B + D % in % C % in % A:B ,datos))
>
> Is it the correct formula syntax?

I would recommend using the lme (linear mixed-effects) function from
the nlme package for this.  Please ensure that you have R version
0.90.0 installed, then use
install.packages("nlme")
from within R to obtain and install the package.

fm1 <- lme(abund ~ A * B, random = list(C = ~ 1, D = ~ 1), data = datos)
This will fit the restricted maximum likelihood (REML) estimates.

If you prefer to get maximum likelihood (ML) estimates, include the argument
method = "ML"
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```