library(planex)
#> Loading required package: dplyr
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
#> Loading required package: ggplot2
library(tidyverse)
#> ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
#> ✔ forcats 1.0.1 ✔ stringr 1.6.0
#> ✔ lubridate 1.9.5 ✔ tibble 3.3.1
#> ✔ purrr 1.2.1 ✔ tidyr 1.3.2
#> ✔ readr 2.2.0
#> ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
#> ✖ dplyr::filter() masks stats::filter()
#> ✖ dplyr::lag() masks stats::lag()
#> ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
data(fibras)
glimpse(fibras)
#> Rows: 15
#> Columns: 3
#> $ maquina <int> 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3
#> $ diametro <int> 20, 25, 24, 25, 32, 22, 28, 22, 30, 28, 21, 23, 26, 21, 15
#> $ forca <int> 36, 41, 39, 42, 49, 40, 48, 39, 45, 44, 35, 37, 42, 34, 32
fibras <- fibras %>%
mutate(
maquina = as.factor(maquina)
)
fit <- aov(forca ~ diametro + maquina, data = fibras)
testResiduals(fit)
#>
#> Shapiro-Wilk normality test
#>
#> data: resid
#> W = 0.96159, p-value = 0.7201
#>
#> ------------------------------------------
#> Bartlett test of Homogeneity of Variances:
#> Bartlett's K-squared df p.value
#> maquina 1.548563 2 0.4610348
#>
#> -----------------------------------------------
#> Durbin-Watson Test for Autocorrelated Errors:
#> lag Autocorrelation D-W Statistic p-value
#> 1 -0.03469267 1.93149 0.47
#> Alternative hypothesis: rho != 0
plotResiduals(fit)
#> Warning: `fortify(<lm>)` was deprecated in ggplot2 4.0.0.
#> ℹ Please use `broom::augment(<lm>)` instead.
#> ℹ The deprecated feature was likely used in the ggplot2 package.
#> Please report the issue at <https://github.com/tidyverse/ggplot2/issues>.
#> This warning is displayed once per session.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.