As an introduction, lets start with one way ANOVA. Here three random variables following a normal distribution with a common standard deviation are created. For this test, the null hypothesis is
\[ H_{0}: \mu_0 = \mu_1 = \mu_2 \]
library(LRTesteR)
set.seed(123)
x <- c(
rnorm(n = 50, mean = 1, sd = 1),
rnorm(n = 50, mean = 3, sd = 1),
rnorm(n = 50, mean = 5, sd = 1)
)
fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50))
fctr <- factor(fctr, levels = c("1", "2", "3"))
gaussian_mu_one_way(x = x, fctr = fctr, conf.level = 0.95)
#> Log Likelihood Statistic: 194.76
#> p value: 0
#> Confidence Level Of Set: 95%
#> Individual Confidence Level: 98.3%
#> Confidence Interval For Group 1: (0.715, 1.354)
#> Confidence Interval For Group 2: (2.834, 3.459)
#> Confidence Interval For Group 3: (4.405, 5.087)
One-way analysis without assuming the data is normally distributed.
empirical_mu_one_way(x = x, fctr = fctr, conf.level = 0.95)
#> Log Likelihood Statistic: 600
#> p value: 0
#> Confidence Level Of Set: 95%
#> Individual Confidence Level: 98.3%
#> Confidence Interval For Group 1: (0.724, 1.355)
#> Confidence Interval For Group 2: (2.829, 3.457)
#> Confidence Interval For Group 3: (4.426, 5.099)
Here two random variables following a Cauchy distribution with a common location and different scales are created. For this test, the null hypothesis is
\[ H_{0}: \gamma_0 = \gamma_1 \]
set.seed(1)
x <- c(rcauchy(n = 50, location = 2, scale = 1), rcauchy(n = 50, location = 2, scale = 3))
fctr <- c(rep(1, 50), rep(2, 50))
fctr <- factor(fctr, levels = c("1", "2"))
cauchy_scale_one_way(x = x, fctr = fctr, conf.level = 0.95)
#> Log Likelihood Statistic: 18.2
#> p value: 0
#> Confidence Level Of Set: 95%
#> Individual Confidence Level: 97.5%
#> Confidence Interval For Group 1: (0.715, 1.71)
#> Confidence Interval For Group 2: (2.388, 5.612)
Here three poisson random variables with different lambdas are created. The null hypothesis is
\[ H_{0}: \lambda_0 = \lambda_1 = \lambda_2 \]
set.seed(1)
x <- c(rpois(n = 50, lambda = 1), rpois(n = 50, lambda = 2), rpois(n = 50, lambda = 3))
fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50))
fctr <- factor(fctr, levels = c("1", "2", "3"))
poisson_lambda_one_way(x = x, fctr = fctr, conf.level = 0.95)
#> Log Likelihood Statistic: 51.11
#> p value: 0
#> Confidence Level Of Set: 95%
#> Individual Confidence Level: 98.3%
#> Confidence Interval For Group 1: (0.765, 1.471)
#> Confidence Interval For Group 2: (1.541, 2.495)
#> Confidence Interval For Group 3: (2.541, 3.735)
All one way tests have a null hypothesis the groups share a common value of the parameter. The alternative is at least one group’s parameter is unequal to the others. If the test involves a nuisance parameter, it is assumed equal across groups for parametric tests. All functions apply the Bonferroni correction to the set of confidence intervals.