Below is my ANOVA code, I would like to plot only the Q-Q, not all four. Can someone please give me some advice?
one_results <- aov(discoloration ~ strawberries, data = one)
one_table <- summary(aov(discoloration ~ strawberries, data = one))
pander(one_table, style='rmarkdown')
plot(one_results)
raytong
2
Hi @dmd061996. You can plot qqplot by plot(one_results, which = 2)
.
1 Like
Hi, and welcome!
One way to do this is with qqPlot()
in the cars package, although you do get an envelope to go with it.
From help(aov)
first example
library(car)
#> Loading required package: carData
op <- options(contrasts = c("contr.helmert", "contr.poly"))
( npk.aov <- aov(yield ~ block + N*P*K, npk) )
#> Call:
#> aov(formula = yield ~ block + N * P * K, data = npk)
#>
#> Terms:
#> block N P K N:P N:K
#> Sum of Squares 343.2950 189.2817 8.4017 95.2017 21.2817 33.1350
#> Deg. of Freedom 5 1 1 1 1 1
#> P:K Residuals
#> Sum of Squares 0.4817 185.2867
#> Deg. of Freedom 1 12
#>
#> Residual standard error: 3.929447
#> 1 out of 13 effects not estimable
#> Estimated effects are balanced
summary(npk.aov)
#> Df Sum Sq Mean Sq F value Pr(>F)
#> block 5 343.3 68.66 4.447 0.01594 *
#> N 1 189.3 189.28 12.259 0.00437 **
#> P 1 8.4 8.40 0.544 0.47490
#> K 1 95.2 95.20 6.166 0.02880 *
#> N:P 1 21.3 21.28 1.378 0.26317
#> N:K 1 33.1 33.14 2.146 0.16865
#> P:K 1 0.5 0.48 0.031 0.86275
#> Residuals 12 185.3 15.44
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coefficients(npk.aov)
#> (Intercept) block1 block2 block3 block4 block5
#> 54.8750000 1.7125000 1.6791667 -1.8229167 -1.0137500 0.2950000
#> N1 P1 K1 N1:P1 N1:K1 P1:K1
#> 2.8083333 -0.5916667 -1.9916667 -0.9416667 -1.1750000 0.1416667
qqPlot(npk.aov)
#> [1] 3 5
Created on 2019-11-03 by the reprex package (v0.3.0)
BTW: Notice that I've used a reproducible example, called a reprex, which always helps questions get more answers.
2 Likes
thank you! this worked great
Although mine worked @raytong has the better solution.
system
Closed
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.