# S3 method for class 'permustats'
autoplot(
  object,
  plot = c("box", "violin", "density", "qqnorm"),
  scale = FALSE,
  facet = FALSE,
  gg.params = list(),
  ...
)

Arguments

object

object from vegan::permustats().

plot

character; the type of plot, or a geom from ggplot2.

scale

logical; use standardized effect sizes (SES)?

facet

logical; should the plot be faceted by term?

gg.params

list; arguments passed to function drawing the box-like object. Depending on argument plot the parameters are passed to ggplot2::geom_boxplot(), ggplot2::geom_violin(), ggplot2::geom_density() or ggplot2::geom_qq().

...

Other parameters passed to functions (ignored).

Details

Function fortify() returns a data frame with variables permutations (numeric) and term (factor labelling the permutation). The result of fortify() can be used to custom build diagnostic plots. autoplot() provides basic plots of vegan::permustats() objects with limited flexibility.

Examples

data(dune, dune.env)
mod <- cca(dune ~ A1 + Management + Moisture, dune.env)
(ano <- anova(mod, by = "onedf"))
#> Permutation test for cca under reduced model
#> Sequential test for contrasts
#> Permutation: free
#> Number of permutations: 999
#> 
#> Model: cca(formula = dune ~ A1 + Management + Moisture, data = dune.env)
#>              Df ChiSquare      F Pr(>F)    
#> A1            1   0.22476 2.7632  0.009 ** 
#> ManagementHF  1   0.13890 1.7076  0.054 .  
#> ManagementNM  1   0.28099 3.4545  0.001 ***
#> ManagementSF  1   0.13512 1.6612  0.076 .  
#> Moisture.L    1   0.21976 2.7017  0.002 ** 
#> Moisture.Q    1   0.05769 0.7093  0.722    
#> Moisture.C    1   0.08193 1.0073  0.360    
#> Residual     12   0.97610                  
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
pstat <- permustats(ano)
head(fortify(pstat))
#> # A tibble: 6 × 2
#>   permutations term 
#>          <dbl> <fct>
#> 1        -2.06 A1   
#> 2        -1.65 A1   
#> 3        -1.90 A1   
#> 4        -2.16 A1   
#> 5        -1.84 A1   
#> 6        -1.99 A1   
autoplot(pstat, "box")



if (requireNamespace("ggplot2")) {
  library("ggplot2")

  # avoid overplotting x-axis text
  autoplot(pstat, "violin") +
    scale_x_discrete(guide = guide_axis(n.dodge = 2))

  autoplot(pstat, "qqnorm", facet = TRUE) +
    geom_qq_line()
}


autoplot(pstat, "density", facet = TRUE)