# [R] Howto calculate MS from a unbalanced data

Ronaldo Reis Jr. chrysopa at insecta.ufv.br
Tue Mar 25 20:19:11 CET 2003

```Hi,

I make a nested lme analysis, it is ok.
The estructure is:

lme(y~x,random=~1|x/animal)

It is no the exactly formula, but the teoretical formula. The real formula
have a new variable with x/animal group.

Now I try to construct a nested lme table like the traditional anova table to
presentation of the data.

---------------------------------------------
| Source | SS | d.f. |    MS    | F  | P    |
---------------------------------------------
a           2                 1.9 0.1682
b           21
resid         657   var(resid)
---------------------------------------------
Total   2222
---------------------------------------------
For balanced data it is easy to complete. I use:

MSb = var(b)*n + var(resid)
MSa = var(a)*bn + MSb

where:

var(a), var(b) and var(resid) are the variance component get by the
VarCorr(m1).

MSb and MSa are my questions (Mean Square).

n is the number of samples in group x/animal (unbalanced)

b is the number of animal in x (balanced)

Howto calculate the n if it is different for each group?

Exist any other easy form to present the results?

Thanks
Ronaldo
--
Justice always prevails ... three times out of seven!
-- Michael J. Wagner
--
|   // | \\   [*****************************][*******************]
|| ( õ   õ )  [Ronaldo Reis Júnior          ][PentiumIII-600     ]
|      V      [UFV/DBA-Entomologia          ][HD: 30 + 10 Gb     ]
||  /     \   [36571-000 Viçosa - MG        ][RAM: 128 Mb        ]
|  /(.''`.)\  [Fone: 31-3899-2532           ][Video: SiS620-8Mb  ]
||/(: :'  :)\ [chrysopa at insecta.ufv.br      ][Modem: Pctel-onboar]
|/ (`. `'` ) \[ICQ#: 5692561                ][Kernel: 2.4.18     ]
||  ( `-  )   [*****************************][*******************]
||| _/   \_Powered by GNU/Debian W/Sarge D+ || Lxuser#: 205366

```