Ronaldo Reis Jr.
2003-Apr-09 19:07 UTC
[R] [OFF] Nested or not nested, this is the question.
Hi, sorry by this off. I'm still try to understand nested design. I have the follow example (fiction): I have 12 plots in 4 sizes in 3 replicates (4*3 = 12) In each plot I put 2 species (A and B) to reproduce. After a period I make samples in each board and count the number of individuals total (tot) and individuals A and B (nsp). Others individuals excepts A and B are in total of individuals. This make a dataset with the 24 lines and not 12. Its smell pseudoreplication in a nested design, OK? I need to know: the species are different in proportion? the size affect the species's proportion? existe interaction between size and species? I make the analysis.> m.lme <- lme(nsp/tot~size*specie,random=~1|size/specie) > anova(m.lme)numDF denDF F-value p-value (Intercept) 1 16 374.7121 <.0001 size 1 2 37.8683 0.0254 specie 1 2 18.2036 0.0508 size:specie 1 2 9.3203 0.0926>This is the correct mean to make this analysis? or> m.lme <- lme(nsp/tot~size*specie,random=~1|plot/specie) > anova(m.lme)numDF denDF F-value p-value (Intercept) 1 10 579.8853 <.0001 size 1 10 58.6030 <.0001 specie 1 10 59.5235 <.0001 size:specie 1 10 30.4760 3e-04>or neither? I know about the distribution (binomial in this case), but I try to understand the nested design. Thanks for any help. The dataset is: plot size specie nsp tot 1 1 10 A 2 20 2 1 10 B 6 20 3 5 10 A 3 20 4 5 10 B 5 20 5 9 10 A 1 20 6 9 10 B 4 20 7 2 20 A 5 20 8 2 20 B 8 20 9 6 20 A 6 20 10 6 20 B 9 20 11 10 20 A 4 20 12 10 20 B 6 20 13 3 30 A 8 20 14 3 30 B 9 20 15 7 30 A 9 20 16 7 30 B 10 20 17 11 30 A 7 20 18 11 30 B 8 20 19 4 40 A 10 20 20 4 40 B 9 20 21 8 40 A 9 20 22 8 40 B 10 20 23 12 40 A 9 20 24 12 40 B 9 20 -- Great minds run in great circles. -- | // | \\ [*****************************][*******************] || ( ? ? ) [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
Peter Dalgaard BSA
2003-Apr-09 20:03 UTC
[R] [OFF] Nested or not nested, this is the question.
"Ronaldo Reis Jr." <chrysopa at insecta.ufv.br> writes:> I have 12 plots in 4 sizes in 3 replicates (4*3 = 12) > In each plot I put 2 species (A and B) to reproduce. > After a period I make samples in each board and count the number of > individuals total (tot) and individuals A and B (nsp). Others individuals > excepts A and B are in total of individuals. > > This make a dataset with the 24 lines and not 12. Its smell pseudoreplication > in a nested design, OK? > > I need to know: > > the species are different in proportion? > > the size affect the species's proportion? > > existe interaction between size and species? > > I make the analysis. > > > m.lme <- lme(nsp/tot~size*specie,random=~1|size/specie) > > anova(m.lme) > numDF denDF F-value p-value > (Intercept) 1 16 374.7121 <.0001 > size 1 2 37.8683 0.0254 > specie 1 2 18.2036 0.0508 > size:specie 1 2 9.3203 0.0926 > > > > This is the correct mean to make this analysis? > > or > > > m.lme <- lme(nsp/tot~size*specie,random=~1|plot/specie) > > anova(m.lme) > numDF denDF F-value p-value > (Intercept) 1 10 579.8853 <.0001 > size 1 10 58.6030 <.0001 > specie 1 10 59.5235 <.0001 > size:specie 1 10 30.4760 3e-04 > > > > or neither?Neither. First of all, you have numDF = 1 for things that have more than two levels, so you forgot to make them factors. reis$plot<-factor(reis$plot) reis$size<-factor(reis$size) reis$specie<-factor(reis$specie) Then you seem to be needing something that describes the replication, and you're not actually telling us, but if I guess that plots 1-4 is the 1st replication and 5-8 and 9-12 are the others, then this should work: reis$repl <- factor((as.numeric(reis$plot)-1)%/%4+1) table(reis$plot,reis$repl) # just to check now you can do anova(lme(nsp/tot~size*specie,random=~1|repl/plot,data=reis)) and have numDF denDF F-value p-value (Intercept) 1 8 207.18935 <.0001 size 3 6 94.58027 <.0001 specie 1 8 57.14293 1e-04 size:specie 3 8 10.28573 4e-03 or, as I'd prefer in a balanced study: summary(aov(nsp/tot~specie*size+Error(repl+plot),data=reis)) Error: repl Df Sum Sq Mean Sq F value Pr(>F) Residuals 2 0.027708 0.013854 Error: plot Df Sum Sq Mean Sq F value Pr(>F) size 3 0.305417 0.101806 94.58 1.927e-05 *** Residuals 6 0.006458 0.001076 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Error: Within Df Sum Sq Mean Sq F value Pr(>F) specie 1 0.041667 0.041667 57.143 6.551e-05 *** specie:size 3 0.022500 0.007500 10.286 0.00404 ** Residuals 8 0.005833 0.000729 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 (Error(repl/plot) actually works too because repl:plot is the same as plot) This gets a little confusin because "repl" is a coarsening of "plot". It may be easier with a within-repl numbering, which you can get by noting that plot is equivalent to repl:size anova(lme(nsp/tot~size*specie,random=~1|repl/size,data=reis)) summary(aov(nsp/tot~specie*size+Error(repl/size),data=reis)) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907