Bautista, Smith and Steiner (BSS) test for multiple comparisons. Implements a procedure for grouping treatments following the determination of differences among them. First, a cluster analysis of the treatment means is performed and the two closest means are grouped. A nested analysis of variance from the original ANOVA is then constructed with the treatment source now partitioned into "groups" and "treatments within groups". This process is repeated until there are no differences among the group means or there are differences among the treatments within groups.
Arguments
- y
Either a model (created with
lm()oraov()) or a numerical vector with the values of the response variable for each unit.- trt
If
yis a model, a string with the name of the column containing the treatments. Ifyis a vector, a vector of the same length asywith the treatments for each unit.- alpha
Numeric value corresponding to the significance level of the test. The default value is 0.05.
- show_plot
Logical value indicating whether the constructed dendrogram should be plotted or not.
- console
Logical value indicating whether the results should be printed on the console or not.
- abline_options
listwith optional arguments for the line in the dendrogram.- ...
Optional arguments for the
plot()function.
Value
A list with three data.frame and one hclust:
- stats
data.framecontaining summary statistics by treatment.- groups
data.frameindicating the group to which each treatment is assigned.- parameters
data.framewith the values used for the test.treatmentsis the total number of treatments andalphais the significance level used.- dendrogram_data
object of class
hclustwith data used to build the dendrogram.
References
Bautista, M. G., Smith, D. W., & Steiner, R. L. (1997). A Cluster-Based Approach to Means Separation. Journal of Agricultural, Biological, and Environmental Statistics, 2(2), 179-197. doi:10.2307/1400402
Examples
data("PlantGrowth")
# Using vectors -------------------------------------------------------
weights <- PlantGrowth$weight
treatments <- PlantGrowth$group
bss_test(y = weights, trt = treatments, show_plot = FALSE)
#> # A tibble: 3 × 2
#> treatment group
#> <fct> <dbl>
#> 1 trt1 1
#> 2 ctrl 1
#> 3 trt2 2
#> Treatments within the same group are not significantly different
# Using a model -------------------------------------------------------
model <- lm(weights ~ treatments)
bss_test(y = model, trt = "treatments", show_plot = FALSE)
#> # A tibble: 3 × 2
#> treatment group
#> <fct> <dbl>
#> 1 trt1 1
#> 2 ctrl 1
#> 3 trt2 2
#> Treatments within the same group are not significantly different
