Empirical likelihood is a nonparametric method of inference based on a data driven likelihood ratio function. Like the bootstrap and jackknife, empirical likelihood inference does not require us to specify a family of distributions for the data. Like parametric likelihood methods, empirical likelihood makes an automatic determination of the shape of confidence regions […] and has very favorable asymptotic power properties. It can be thought of as a bootstrap that does not resample and as a likelihood without parametric assumptions. (Owen 2001)

One sample and one-way tests are implemented. Note the distribution does not need to be symmetrical and less data is needed.

```
library(LRTesteR)
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")
#> Log Likelihood Statistic: 4.36
#> p value: 0.037
#> Confidence Level: 95%
#> Confidence Interval: (1.028, 2.486)
```

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

```
set.seed(1)
x <- c(
rinvgauss(n = 35, mean = 1, dispersion = 1),
rinvgauss(n = 40, mean = 2, dispersion = 3),
rinvgauss(n = 45, mean = 3, dispersion = 5)
)
fctr <- c(rep(1, 35), rep(2, 40), rep(3, 45))
fctr <- factor(fctr, levels = c("1", "2", "3"))
empirical_mu_one_way(x = x, fctr = fctr, conf.level = .95)
#> Log Likelihood Statistic: 50.89
#> p value: 0
#> Confidence Level Of Set: 95%
#> Individual Confidence Level: 98.3%
#> Confidence Interval For Group 1: (0.759, 1.688)
#> Confidence Interval For Group 2: (1.472, 5.16)
#> Confidence Interval For Group 3: (2.481, 14.701)
```

Any quantile can be tested. In this example, the null hypothesis is the median (Q equal to .50) is 0 (value argument).

```
set.seed(2)
x <- rnorm(n = 30, mean = 0, sd = 1)
empirical_quantile_one_sample(x = x, Q = .50, value = 0, alternative = "two.sided")
#> Log Likelihood Statistic: 2.16
#> p value: 0.142
#> Confidence Level: 95%
#> Confidence Interval: (-0.24, 0.792)
```

Other quantiles can be tested as well.

```
# Q1
empirical_quantile_one_sample(x = x, Q = .25, value = 0, alternative = "two.sided")
#> Log Likelihood Statistic: 2
#> p value: 0.157
#> Confidence Level: 95%
#> Confidence Interval: (-1.2, 0.036)
```

```
# Q3
empirical_quantile_one_sample(x = x, Q = .75, value = 0, alternative = "two.sided")
#> Log Likelihood Statistic: 19.58
#> p value: 0
#> Confidence Level: 95%
#> Confidence Interval: (0.418, 1.782)
```

In one-way analysis, equality of a quantile is tested. Here, a common median (Q equal to .50) is tested.

```
set.seed(1)
x <- c(
rnorm(n = 35, mean = 1, sd = 1),
rnorm(n = 40, mean = 2, sd = 1.25),
rnorm(n = 45, mean = 3, sd = 1.5)
)
fctr <- c(rep(1, 35), rep(2, 40), rep(3, 45))
fctr <- factor(fctr, levels = c("1", "2", "3"))
empirical_quantile_one_way(x = x, Q = .50, fctr = fctr)
#> Log Likelihood Statistic: 39.74
#> p value: 0
#> Confidence Level Of Set: 95%
#> Individual Confidence Level: 98.3%
#> Confidence Interval For Group 1: (0.695, 1.594)
#> Confidence Interval For Group 2: (1.507, 2.712)
#> Confidence Interval For Group 3: (2.308, 3.576)
```

Note sample size does not have to be equal.