Nothing
## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
## ----eval=FALSE---------------------------------------------------------------
# install.packages("varequal")
## ----eval=FALSE---------------------------------------------------------------
# if (!require("pak")) install.packages("pak")
# pak::pak("P10911004-NPUST/varequal")
## -----------------------------------------------------------------------------
library(varequal)
# For reproducibility
set.seed(123)
## -----------------------------------------------------------------------------
data("roGFP")
df1 <- roGFP[[1]]
is_var_equal(df1, ro ~ grp)
## -----------------------------------------------------------------------------
is_var_equal(df1, ro ~ grp)
## -----------------------------------------------------------------------------
is_var_equal(df1, ro ~ grp, summary = TRUE)
## -----------------------------------------------------------------------------
check_var_equal(df1, ro ~ grp, method = "LV")
## -----------------------------------------------------------------------------
Levene_test(df1, ro ~ grp)
## -----------------------------------------------------------------------------
check_var_equal(df1, ro ~ grp, method = "BF")
## -----------------------------------------------------------------------------
x <- list(A = rnorm(12), B = rnorm(12), C = rnorm(12))
is_var_equal(x)
## -----------------------------------------------------------------------------
ab <- Ansari_Bradley_test(df1, ro ~ grp)
## -----------------------------------------------------------------------------
bl <- Bartlett_test(df1, ro ~ grp, summary = TRUE)
## -----------------------------------------------------------------------------
mbf <- Brown_Forsythe_test(df1, ro ~ grp)
## -----------------------------------------------------------------------------
bf <- Brown_Forsythe_test(df1, ro ~ grp, method = "BF")
## -----------------------------------------------------------------------------
Brown_Forsythe_test(df1, ro ~ grp, transform = function(x) abs(x - mean(x)))
## -----------------------------------------------------------------------------
fk <- Fligner_Killeen_test(df1, ro ~ grp)
## -----------------------------------------------------------------------------
lg <- Lam_G_test(df1, ro ~ grp)
## -----------------------------------------------------------------------------
Lam_G_test(df1, ro ~ grp, alternative = "two.sided")
Lam_G_test(df1, ro ~ grp, alternative = "greater")
Lam_G_test(df1, ro ~ grp, alternative = "less")
## -----------------------------------------------------------------------------
lv <- Levene_test(df1, ro ~ grp)
## -----------------------------------------------------------------------------
Levene_test(df1, ro ~ grp, transform = function(x) (x - median(x)) ^ 2)
## -----------------------------------------------------------------------------
# Absolute deviations from the mean
Levene_test(df1, ro ~ grp, transform = function(x) abs(x - mean(x)))
# Square-root absolute deviations
Levene_test(df1, ro ~ grp, transform = function(x) sqrt(abs(x - median(x))))
## -----------------------------------------------------------------------------
ob <- O.Brien_test(df1, ro ~ grp)
## -----------------------------------------------------------------------------
om <- O.Neill_Mathews_test(df1, ro ~ grp)
## -----------------------------------------------------------------------------
method <- "FK"
result <- check_var_equal(df1, ro ~ grp, method = method, silent = TRUE)
result
## -----------------------------------------------------------------------------
for (s in 1:5) {
cat("sensitivity =", s, "\n")
print(is_var_equal(df1, ro ~ grp, sensitivity = s))
}
## -----------------------------------------------------------------------------
result <- is_var_equal(df1, ro ~ grp, summary = TRUE)
result$is_var_equal
result$summary
## ----fig.width=6--------------------------------------------------------------
text = sprintf("Variance equal: %s", is_var_equal(df1, ro ~ grp))
boxplot(ro ~ grp,
data = df1,
main = text,
horizontal = TRUE,
xlab = "Redox index",
ylab = "Group")
points(x = df1$ro,
y = jitter(as.numeric(df1$grp), amount = 0.15))
## ----fig.width=6--------------------------------------------------------------
data("CYCB1")
df2 <- CYCB1[[2]]
text = sprintf("Variance equal: %s", is_var_equal(df2, cells ~ grp))
boxplot(cells ~ grp,
data = df2,
main = text,
horizontal = TRUE,
xlab = "Cell number",
ylab = "Group"
)
points(x = df2$cells,
y = jitter(as.numeric(df2$grp), amount = 0.15))
## -----------------------------------------------------------------------------
data("roGFP")
str(roGFP[[1]])
## -----------------------------------------------------------------------------
data("CYCB1")
str(CYCB1[[1]])
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.