Dear all, I recently conducted aov calculations of datasets::CO2. When I'm using the following code: 'summary(aov(CO2$uptake~CO2$Treatment*CO2$Plant))'. Everything is fine. I get a result for Plant and Treatment. However, if using: 'summary(aov(CO2$uptake~CO2$Plant*CO2$Treatment))' 'Treatment' is ignored. I'm using R 3.6 on Linux Mint. Any idea why this happens? Regards, Konrad
Possible bug
5 messages · Konrad, Richard M. Heiberger, Kevin E. Thorpe +2 more
with(CO2, table(Treatment, Plant))
Plant Treatment Qn1 Qn2 Qn3 Qc1 Qc3 Qc2 Mn3 Mn2 Mn1 Mc2 Mc3 Mc1 nonchilled 7 7 7 0 0 0 7 7 7 0 0 0 chilled 0 0 0 7 7 7 0 0 0 7 7 7
Plants are nested within Treatments. Hence when Plant is first, it picks up the effect of Treatment. You can see that in the sums of squares and degrees of freedom from both ANOVA tables.
summary(aov(CO2$uptake~CO2$Treatment*CO2$Plant))
Df Sum Sq Mean Sq F value Pr(>F) CO2$Treatment 1 988 988.1 14.685 0.000269 *** CO2$Plant 10 3874 387.4 5.757 2.66e-06 *** Residuals 72 4845 67.3 --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
summary(aov(CO2$uptake~CO2$Plant*CO2$Treatment))
Df Sum Sq Mean Sq F value Pr(>F) CO2$Plant 11 4862 442.0 6.569 1.84e-07 *** Residuals 72 4845 67.3 --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
On Mar 17, 2022, at 10:17, konrad via R-help <r-help at r-project.org> wrote: summary(aov(CO2$uptake~CO2$Plant*CO2$Treatment))'
Take a look at: xtabs(~Plant+Treatment, data=CO2) It appears to me that Plant incorporates both plant and treatment for use in a mixed model context. If you notice, Treatment is not completely ignored in the second version. The DF=11 for plant whereas in the first analysis it is 10 and there is 1 for Treatment. I may be wrong, but that is my guess.
On Mar 17, 2022, at 10:17 AM, konrad via R-help <r-help at r-project.org> wrote: Dear all, I recently conducted aov calculations of datasets::CO2. When I'm using the following code: 'summary(aov(CO2$uptake~CO2$Treatment*CO2$Plant))'. Everything is fine. I get a result for Plant and Treatment. However, if using: 'summary(aov(CO2$uptake~CO2$Plant*CO2$Treatment))' 'Treatment' is ignored. I'm using R 3.6 on Linux Mint. Any idea why this happens? Regards, Konrad
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Kevin E. Thorpe Head of Biostatistics, Applied Health Research Centre (AHRC) Li Ka Shing Knowledge Institute of St. Michael?s Hospital Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.thorpe at utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016
... and just a note, use the data argument in aov (and lm and other modeling functions): aov(uptake ~ Plant * Treatment, data = CO2) Makes the code more readable. Also note, you probably meant ~Plant + Treatment, as interactions are meaningless here. See ?lm for the syntax of model specification. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Thu, Mar 17, 2022 at 11:10 AM Richard M. Heiberger <rmh at temple.edu> wrote:
with(CO2, table(Treatment, Plant))
Plant Treatment Qn1 Qn2 Qn3 Qc1 Qc3 Qc2 Mn3 Mn2 Mn1 Mc2 Mc3 Mc1 nonchilled 7 7 7 0 0 0 7 7 7 0 0 0 chilled 0 0 0 7 7 7 0 0 0 7 7 7
Plants are nested within Treatments. Hence when Plant is first, it picks up the effect of Treatment. You can see that in the sums of squares and degrees of freedom from both ANOVA tables.
summary(aov(CO2$uptake~CO2$Treatment*CO2$Plant))
Df Sum Sq Mean Sq F value Pr(>F) CO2$Treatment 1 988 988.1 14.685 0.000269 *** CO2$Plant 10 3874 387.4 5.757 2.66e-06 *** Residuals 72 4845 67.3 --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
summary(aov(CO2$uptake~CO2$Plant*CO2$Treatment))
Df Sum Sq Mean Sq F value Pr(>F) CO2$Plant 11 4862 442.0 6.569 1.84e-07 *** Residuals 72 4845 67.3 --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
On Mar 17, 2022, at 10:17, konrad via R-help <r-help at r-project.org> wrote: summary(aov(CO2$uptake~CO2$Plant*CO2$Treatment))'
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Hi, The plant and Treatment are aliased (if you know the value of plant you know the value of treatment) so you shouldn't add them together in the same model. That being said when you enter treatment first and then plant you are adding the extra information from plant as the second effect and in the second model when you try to enter treatment as the second effect there's nothing more to fit. If you look closely at the two model you will notice that the total variance and the total degree of freedom are the same. Also when you use *, what you are fitting is plant + treatment + plant:treatment but you don't see the interaction in the model because it is useless in the model. Hope it helps, Charles-?douard Treatment Qn1 Qn2 Qn3 Qc1 Qc3 Qc2 Mn3 Mn2 Mn1 Mc2 Mc3 Mc1 nonchilled 7 7 7 0 0 0 7 7 7 0 0 0 chilled 0 0 0 7 7 7 0 0 0 7 7 7 -----Message d'origine----- De : R-help <r-help-bounces at r-project.org> De la part de konrad via R-help Envoy? : 17 mars 2022 10:17 ? : r-help at r-project.org Objet : [R] Possible bug Dear all, I recently conducted aov calculations of datasets::CO2. When I'm using the following code: 'summary(aov(CO2$uptake~CO2$Treatment*CO2$Plant))'. Everything is fine. I get a result for Plant and Treatment. However, if using: 'summary(aov(CO2$uptake~CO2$Plant*CO2$Treatment))' 'Treatment' is ignored. I'm using R 3.6 on Linux Mint. Any idea why this happens? Regards, Konrad ______________________________________________ <mailto:R-help at r-project.org> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see <https://stat.ethz.ch/mailman/listinfo/r-help> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide <http://www.R-project.org/posting-guide.html> http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.