The goal of adas.utils is to provide some utility functions to be used in the course Analysis of Data and Statistics at the University of Trento, Italy. Course contents are on https://paolobosetti.quarto.pub/ADAS/.
Installation
You can install the development version of adas.utils from GitHub with:
# install.packages("devtools") devtools::install_github("pbosetti/adas.utils", build_vignettes = TRUE)
Examples
Loading data sets
On https://paolobosetti.quarto.pub/data.html there are a list of
example datasets to be used during the course. You can load them with
the examples_url function:
examples_url("battery.dat") |> read.table(header=T) |> head() #> RunOrder StandardOrder Temperature Material Repeat Response #> 1 34 1 15 1 1 130 #> 2 25 2 70 1 1 34 #> 3 16 3 125 1 1 20 #> 4 7 4 15 2 1 150 #> 5 8 5 70 2 1 136 #> 6 1 6 125 2 1 25
Chauvenet’s criterion
The Chauvenet’s criterion is a method to identify possible outliers in a sample. Here is an example:
x <- rnorm(100) x[50] <- 10 chauvenet(x) #> Chauvenet's criterion for sample x #> Suspect outlier: 50, value 10 #> Decision: reject it
Daniel’s plot
Daniel’s plot is a QQ plot of the effects of a non-replicated factorial model. Here is an example:
daniel_plot_qq(lm(Y~A*B*C*D, data=filtration))
The stats::TukeyHSD function in base R provides a way to perform
multiple comparisons of means. It can print the results in tabular form
or can be plotted with the plot method:
library(tidyverse) examples_url("battery.dat") %>% read_table() %>% mutate(across(c(Temperature, Material), factor)) %>% mutate(Material = LETTERS[Material]) %>% ggTukey(Response~Temperature, splt=~Material)
Pareto chart
The pareto_chart function is a generic function that creates a Pareto
chart either from a general data frame or from the effects of a lm
object. Here is an example:
library(tidyverse) set.seed(1) tibble( val=rnorm(10, sd=5), cat=LETTERS[1:length(val)] ) %>% pareto_chart(labels=cat, values=val)
# For a linear model: pareto_chart(lm(Y~A*B*C*D, data=filtration))
Design of Experiments
There is a host of functions to be used in the context of Design of Experiments. Here is an example to prepare a design matrix for a



