AULA 11

Author

ARLAM

Anova fatorial

library(tidyverse)
library(readxl)
fungicida_vaso<-read_excel("C:dados-diversos.xlsx", "fungicida_vaso")

m1<- fungicida_vaso |> 
  mutate(inc=dis_sp/n_sp*100)
m1 |> 
ggplot(aes(x=treat, y=inc))+
  geom_jitter(width = 0.1)+facet_wrap(~dose)

m1<-aov(log(inc+0.5)~treat*dose, 
        data=m1)
summary(m1)
            Df Sum Sq Mean Sq F value  Pr(>F)   
treat        1 12.928  12.928  13.980 0.00179 **
dose         1  5.663   5.663   6.124 0.02491 * 
treat:dose   1  5.668   5.668   6.129 0.02486 * 
Residuals   16 14.796   0.925                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
library(performance)
Warning: package 'performance' was built under R version 4.2.3
check_normality(m1)
Warning: Non-normality of residuals detected (p = 0.050).
check_heteroscedasticity(m1)
OK: Error variance appears to be homoscedastic (p = 0.180).
library(DHARMa)
This is DHARMa 0.4.6. For overview type '?DHARMa'. For recent changes, type news(package = 'DHARMa')
plot(simulateResiduals(m1))
Warning in checkModel(fittedModel): DHARMa: fittedModel not in class of
supported models. Absolutely no guarantee that this will work!

milho3<-read_excel("C:dados-diversos.xlsx", "milho")
m4<-aov(yield~hybrid,
        data = milho3)
summary(m4)
            Df    Sum Sq  Mean Sq F value   Pr(>F)    
hybrid       5 105876446 21175289   8.688 1.02e-05 ***
Residuals   42 102371996  2437428                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
library(agridat)
data(cochran.beets)
dat = cochran.beets

# P has strong effect
libs(lattice)
Warning: package 'lattice' was built under R version 4.2.3
xyplot(yield ~ plants|fert, dat, main="cochran.beets")