Nonparametric Tests

Empirical Likelihood Tests

These tests do not require any assumption about the underlying distribution. In addition, they work with smaller sample sizes.

library(LRTesteR)

set.seed(1)
x <- rnorm(n = 30, mean = 1, sd = 1)
empirical_mu_one_sample(x = x, mu = 0, alternative = "two.sided")
#> [1] "Log Likelihood Statistic: 26.6"
#> [1] "p value: 0"
#> [1] "Confidence Level: 95%"
#> [1] "Confidence Interval: (0.722, 1.387)"

The distribution does not need to be symmetrical.

library(statmod)

set.seed(1)
x <- rinvgauss(n = 30, mean = 2.25, dispersion = 2)
empirical_mu_one_sample(x = x, mu = 1, alternative = "two.sided")
#> [1] "Log Likelihood Statistic: 4.36"
#> [1] "p value: 0.037"
#> [1] "Confidence Level: 95%"
#> [1] "Confidence Interval: (1.028, 2.486)"

The one way test does not require nuisance parameters to be equal.

set.seed(1)
x <- c(rnorm(n = 30, mean = 1, sd = 1), rnorm(n = 30, mean = 1.5, sd = 1.5), rnorm(n = 30, mean = 2, sd = 2))
fctr <- c(rep(1, 30), rep(2, 30), rep(3, 30))
fctr <- factor(fctr, levels = c("1", "2", "3"))
empirical_mu_one_way(x = x, fctr = fctr, conf.level = .95)
#> [1] "Log Likelihood Statistic: 17.46"
#> [1] "p value: 0"
#> [1] "Confidence Level Of Set: 95%"
#> [1] "Individual Confidence Level: 98.3%"
#> [1] "Confidence Interval For Group 1: (0.632, 1.451)"
#> [1] "Confidence Interval For Group 2: (1.191, 2.245)"
#> [1] "Confidence Interval For Group 3: (1.396, 3.117)"

Sample size can be unequal.

set.seed(1)
x <- c(rnorm(n = 30, mean = 1, sd = 1), rnorm(n = 40, mean = 1.5, sd = 1.5), rnorm(n = 50, mean = 2, sd = 2))
fctr <- c(rep(1, 30), rep(2, 40), rep(3, 50))
fctr <- factor(fctr, levels = c("1", "2", "3"))
empirical_mu_one_way(x = x, fctr = fctr, conf.level = .95)
#> [1] "Log Likelihood Statistic: 16.56"
#> [1] "p value: 0"
#> [1] "Confidence Level Of Set: 95%"
#> [1] "Individual Confidence Level: 98.3%"
#> [1] "Confidence Interval For Group 1: (0.632, 1.451)"
#> [1] "Confidence Interval For Group 2: (1.297, 2.377)"
#> [1] "Confidence Interval For Group 3: (1.551, 2.659)"