| Title: | Likelihood Ratio Tests and Confidence Intervals |
|---|---|
| Description: | A collection of hypothesis tests and confidence intervals based on the likelihood ratio <https://en.wikipedia.org/wiki/Likelihood-ratio_test>. |
| Authors: | Greg McMahan [aut, cre] |
| Maintainer: | Greg McMahan <[email protected]> |
| License: | GPL-3 |
| Version: | 2.0.0 |
| Built: | 2026-09-21 10:02:00 UTC |
| Source: | https://github.com/gmcmacran/lrtester |
Test the equality of shape 1 parameters of beta distributions.
beta_shape1_one_way_test(x, fctr, conf.level = 0.95)beta_shape1_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All shape1s are equal. (shape1_1 = shape1_2 ... shape1_k).
Alternative: At least one shape1 is not equal.
The shape2s are treated as nuisance parameters and are estimated separately for each group.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rbeta(150, 1, 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) beta_shape1_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rbeta(50, 1, 2), rbeta(50, 2, 2), rbeta(50, 3, 2)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) beta_shape1_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rbeta(150, 1, 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) beta_shape1_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rbeta(50, 1, 2), rbeta(50, 2, 2), rbeta(50, 3, 2)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) beta_shape1_one_way_test(x, fctr, .95)
Test the shape1 parameter of a beta distribution.
beta_shape1_test(x, shape1, alternative = "two.sided", conf.level = 0.95)beta_shape1_test(x, shape1, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
shape1 |
a number indicating the tested value of the shape1 parameter. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rbeta(100, shape1 = 1, shape2 = 2) beta_shape1_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rbeta(100, shape1 = 3, shape2 = 2) beta_shape1_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rbeta(100, shape1 = 1, shape2 = 2) beta_shape1_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rbeta(100, shape1 = 3, shape2 = 2) beta_shape1_test(x, 1, "greater")
Test the equality of shape 2 parameters of beta distributions.
beta_shape2_one_way_test(x, fctr, conf.level = 0.95)beta_shape2_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All shape2s are equal. (shape2_1 = shape2_2 ... shape2_k).
Alternative: At least one shape2 is not equal.
The shape1s are treated as nuisance parameters and are estimated separately for each group.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rbeta(150, 2, 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) beta_shape2_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rbeta(50, 2, 1), rbeta(50, 2, 2), rbeta(50, 2, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) beta_shape2_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rbeta(150, 2, 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) beta_shape2_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rbeta(50, 2, 1), rbeta(50, 2, 2), rbeta(50, 2, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) beta_shape2_one_way_test(x, fctr, .95)
Test the shape2 parameter of a beta distribution.
beta_shape2_test(x, shape2, alternative = "two.sided", conf.level = 0.95)beta_shape2_test(x, shape2, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
shape2 |
a number indicating the tested value of the shape2 parameter. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rbeta(100, shape1 = 1, shape2 = 1) beta_shape2_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rbeta(100, shape1 = 1, shape2 = 3) beta_shape2_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rbeta(100, shape1 = 1, shape2 = 1) beta_shape2_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rbeta(100, shape1 = 1, shape2 = 3) beta_shape2_test(x, 1, "greater")
Test the equality of prob parameters of binomial distributions.
binomial_prob_one_way_test(x, size, fctr, conf.level = 0.95)binomial_prob_one_way_test(x, size, fctr, conf.level = 0.95)
x |
a numeric vector indicating number of successes per group. |
size |
a numeric vector indicating number of attempts per group. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All probs are equal. (prob_1 = prob_2 ... prob_k).
Alternative: At least one prob is not equal.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true. set.seed(1) x <- rbinom(3, 50, .5) size <- rep(50, length(x)) fctr <- factor(1:length(x)) binomial_prob_one_way_test(x, size, fctr, .95) # Null is false set.seed(1) x <- rbinom(3, 50, c(.25, .50, .75)) size <- rep(50, length(x)) fctr <- factor(1:length(x)) binomial_prob_one_way_test(x, size, fctr, .95)library(LRTesteR) # Null is true. set.seed(1) x <- rbinom(3, 50, .5) size <- rep(50, length(x)) fctr <- factor(1:length(x)) binomial_prob_one_way_test(x, size, fctr, .95) # Null is false set.seed(1) x <- rbinom(3, 50, c(.25, .50, .75)) size <- rep(50, length(x)) fctr <- factor(1:length(x)) binomial_prob_one_way_test(x, size, fctr, .95)
Test the prob parameter of a binomial distribution.
binomial_prob_test(x, size, prob, alternative = "two.sided", conf.level = 0.95)binomial_prob_test(x, size, prob, alternative = "two.sided", conf.level = 0.95)
x |
Number of successes. |
size |
Number of trials. |
prob |
Hypothesized probability of success. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true. 52 successes. 100 trials binomial_prob_test(52, 100, .50, "two.sided") # Null is false. 75 successes. 100 trials binomial_prob_test(75, 100, .50, "two.sided")library(LRTesteR) # Null is true. 52 successes. 100 trials binomial_prob_test(52, 100, .50, "two.sided") # Null is false. 75 successes. 100 trials binomial_prob_test(75, 100, .50, "two.sided")
Test the equality of location parameters of cauchy distributions.
cauchy_location_one_way_test(x, fctr, conf.level = 0.95)cauchy_location_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All locations are equal. (location_1 = location_2 ... location_k).
Alternative: At least one location is not equal.
The scales are treated as nuisance parameters and are estimated separately for each group.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(2) x <- rcauchy(n = 150, location = 1, scale = 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) cauchy_location_one_way_test(x, fctr, .95) # Null is false set.seed(2) x <- c(rcauchy(50, 1, 2), rcauchy(50, 2, 2), rcauchy(50, 3, 2)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) cauchy_location_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(2) x <- rcauchy(n = 150, location = 1, scale = 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) cauchy_location_one_way_test(x, fctr, .95) # Null is false set.seed(2) x <- c(rcauchy(50, 1, 2), rcauchy(50, 2, 2), rcauchy(50, 3, 2)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) cauchy_location_one_way_test(x, fctr, .95)
Test the location parameter of a cauchy distribution.
cauchy_location_test(x, location, alternative = "two.sided", conf.level = 0.95)cauchy_location_test(x, location, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
location |
a number indicating the tested value of the location parameter. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rcauchy(n = 100, location = 1, scale = 2) cauchy_location_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rcauchy(n = 100, location = 3, scale = 2) cauchy_location_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rcauchy(n = 100, location = 1, scale = 2) cauchy_location_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rcauchy(n = 100, location = 3, scale = 2) cauchy_location_test(x, 1, "greater")
Test the equality of scale parameters of cauchy distributions.
cauchy_scale_one_way_test(x, fctr, conf.level = 0.95)cauchy_scale_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All scales are equal. (scale_1 = scale_2 ... scale_k).
Alternative: At least one scale is not equal.
The locations are treated as nuisance parameters and are estimated separately for each group.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rcauchy(n = 150, 1, 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) cauchy_scale_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rcauchy(50, 2, 1), rcauchy(50, 2, 2), rcauchy(50, 2, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) cauchy_scale_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rcauchy(n = 150, 1, 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) cauchy_scale_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rcauchy(50, 2, 1), rcauchy(50, 2, 2), rcauchy(50, 2, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) cauchy_scale_one_way_test(x, fctr, .95)
Test the scale parameter of a cauchy distribution.
cauchy_scale_test(x, scale, alternative = "two.sided", conf.level = 0.95)cauchy_scale_test(x, scale, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
scale |
a number indicating the tested value of the scale parameter. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rcauchy(n = 100, location = 1, scale = 2) cauchy_scale_test(x, 2, "two.sided") # Null is false set.seed(1) x <- rcauchy(n = 100, location = 3, scale = 2) cauchy_scale_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rcauchy(n = 100, location = 1, scale = 2) cauchy_scale_test(x, 2, "two.sided") # Null is false set.seed(1) x <- rcauchy(n = 100, location = 3, scale = 2) cauchy_scale_test(x, 1, "greater")
Nonparametric test for the equality of means of an unknown distribution.
empirical_mu_one_way_test(x, fctr, conf.level = 0.95)empirical_mu_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All mus are equal. (mu1 = mu2 ... muk).
Alternative: At least one mu is not equal.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Owen. Empirical Likelihood. Chapman & Hall/CRC.
Owen. (1991). Empirical Likelihood for Linear Models. The Annals of Statistics, 19(4).
library(LRTesteR) # Null is true set.seed(1) x <- rnorm(75, 1, 1) fctr <- c(rep(1, 25), rep(2, 25), rep(3, 25)) fctr <- factor(fctr, levels = c("1", "2", "3")) empirical_mu_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rnorm(25, 1, 1), rnorm(25, 2, 1), rnorm(25, 3, 1)) fctr <- c(rep(1, 25), rep(2, 25), rep(3, 25)) fctr <- factor(fctr, levels = c("1", "2", "3")) empirical_mu_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rnorm(75, 1, 1) fctr <- c(rep(1, 25), rep(2, 25), rep(3, 25)) fctr <- factor(fctr, levels = c("1", "2", "3")) empirical_mu_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rnorm(25, 1, 1), rnorm(25, 2, 1), rnorm(25, 3, 1)) fctr <- c(rep(1, 25), rep(2, 25), rep(3, 25)) fctr <- factor(fctr, levels = c("1", "2", "3")) empirical_mu_one_way_test(x, fctr, .95)
Nonparametric test for the mean parameter of an unknown distribution.
empirical_mu_test(x, mu, alternative = "two.sided", conf.level = 0.95)empirical_mu_test(x, mu, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector. |
mu |
a number indicating the tested value of mu. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Owen. Empirical Likelihood. Chapman & Hall/CRC.
library(LRTesteR) # Null is true set.seed(1) x <- rnorm(25, 0, 1) empirical_mu_test(x, 0, "two.sided") # Null is false set.seed(1) x <- rnorm(25, 2, 1) empirical_mu_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rnorm(25, 0, 1) empirical_mu_test(x, 0, "two.sided") # Null is false set.seed(1) x <- rnorm(25, 2, 1) empirical_mu_test(x, 1, "greater")
Nonparametric test for the equality of a quantile from an unknown distribution.
empirical_quantile_one_way_test(x, Q, fctr, conf.level = 0.95)empirical_quantile_one_way_test(x, Q, fctr, conf.level = 0.95)
x |
a numeric vector. |
Q |
The quantile. A single numeric number. (.50 is median.) |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: Quantiles are equal. (Q1 = Q2 ... Qk).
Alternative: At least one quantile is not equal.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Owen. Empirical Likelihood. Chapman & Hall/CRC.
library(LRTesteR) # Null is true set.seed(1) x <- rnorm(75, 1, 1) fctr <- c(rep(1, 25), rep(2, 25), rep(3, 25)) fctr <- factor(fctr, levels = c("1", "2", "3")) empirical_quantile_one_way_test(x, .50, fctr, .95) # Null is false set.seed(1) x <- c(rnorm(25, 1, 1), rnorm(25, 2, 1), rnorm(25, 3, 1)) fctr <- c(rep(1, 25), rep(2, 25), rep(3, 25)) fctr <- factor(fctr, levels = c("1", "2", "3")) empirical_quantile_one_way_test(x, .50, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rnorm(75, 1, 1) fctr <- c(rep(1, 25), rep(2, 25), rep(3, 25)) fctr <- factor(fctr, levels = c("1", "2", "3")) empirical_quantile_one_way_test(x, .50, fctr, .95) # Null is false set.seed(1) x <- c(rnorm(25, 1, 1), rnorm(25, 2, 1), rnorm(25, 3, 1)) fctr <- c(rep(1, 25), rep(2, 25), rep(3, 25)) fctr <- factor(fctr, levels = c("1", "2", "3")) empirical_quantile_one_way_test(x, .50, fctr, .95)
Nonparametric test for a quantile of an unknown distribution.
empirical_quantile_test( x, Q, value, alternative = "two.sided", conf.level = 0.95 )empirical_quantile_test( x, Q, value, alternative = "two.sided", conf.level = 0.95 )
x |
a numeric vector. |
Q |
The quantile. A single numeric number. (.50 is median.) |
value |
A single numeric value that is the hypothesized Q quantile. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
For confidence intervals, an endpoint may be outside the observed range of x. In this case, NA is returned. Reducing confidence or collecting more data will make the CI computable.
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Owen. Empirical Likelihood. Chapman & Hall/CRC.
library(LRTesteR) # Null is true set.seed(1) x <- rnorm(25, 0, 1) empirical_quantile_test(x, .5, 0, "two.sided") # Null is false set.seed(1) x <- rnorm(25, 2, 1) empirical_quantile_test(x, .5, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rnorm(25, 0, 1) empirical_quantile_test(x, .5, 0, "two.sided") # Null is false set.seed(1) x <- rnorm(25, 2, 1) empirical_quantile_test(x, .5, 1, "greater")
Nonparametric test for the equality of variances of unknown distributions.
empirical_variance_one_way_test(x, fctr, conf.level = 0.95)empirical_variance_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All variances are equal. (sigma squared 1 = sigma squared 2 ... sigma squared k).
Alternative: At least one variance is not equal.
Because groups are independent, the -2 log likelihood ratios of the groups add. The common variance under the null is profiled out by minimizing the summed statistic.
The asymptotic approximation requires moderately large groups. In simulations with three normal groups, type I error was near the nominal .05 for groups of 100 or more and mildly inflated for smaller groups.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Owen. Empirical Likelihood. Chapman & Hall/CRC.
Owen. (1991). Empirical Likelihood for Linear Models. The Annals of Statistics, 19(4).
Qin and Lawless. (1994). Empirical Likelihood and General Estimating Equations. The Annals of Statistics, 22(1).
library(LRTesteR) # Null is true set.seed(1) x <- rnorm(30, 0, 1) fctr <- c(rep(1, 15), rep(2, 15)) fctr <- factor(fctr, levels = c("1", "2")) empirical_variance_one_way_test(x, fctr, .95) # Testing variance, not standard deviation # Null is false set.seed(1) x <- c(rnorm(15, 0, 1), rnorm(15, 0, 3)) fctr <- c(rep(1, 15), rep(2, 15)) fctr <- factor(fctr, levels = c("1", "2")) empirical_variance_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rnorm(30, 0, 1) fctr <- c(rep(1, 15), rep(2, 15)) fctr <- factor(fctr, levels = c("1", "2")) empirical_variance_one_way_test(x, fctr, .95) # Testing variance, not standard deviation # Null is false set.seed(1) x <- c(rnorm(15, 0, 1), rnorm(15, 0, 3)) fctr <- c(rep(1, 15), rep(2, 15)) fctr <- factor(fctr, levels = c("1", "2")) empirical_variance_one_way_test(x, fctr, .95)
Nonparametric test for the variance of an unknown distribution.
empirical_variance_test( x, sigma.squared, alternative = "two.sided", conf.level = 0.95 )empirical_variance_test( x, sigma.squared, alternative = "two.sided", conf.level = 0.95 )
x |
a numeric vector. |
sigma.squared |
a number indicating the tested value of sigma squared. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
The mean is a nuisance parameter and is profiled out of the likelihood.
For confidence intervals, an endpoint may not be computable. In this case, NA is returned. Reducing confidence or collecting more data will make the CI computable.
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Owen. Empirical Likelihood. Chapman & Hall/CRC.
library(LRTesteR) # Null is true set.seed(1) x <- rnorm(25, 0, 1) empirical_variance_test(x, 1, "two.sided") # Testing variance, not standard deviation # Null is false set.seed(1) x <- rnorm(25, 0, 1) empirical_variance_test(x, 2, "less")library(LRTesteR) # Null is true set.seed(1) x <- rnorm(25, 0, 1) empirical_variance_test(x, 1, "two.sided") # Testing variance, not standard deviation # Null is false set.seed(1) x <- rnorm(25, 0, 1) empirical_variance_test(x, 2, "less")
Test the equality of rate parameters of exponential distributions.
exponential_rate_one_way_test(x, fctr, conf.level = 0.95)exponential_rate_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All rates are equal. (rate_1 = rate_2 ... rate_k).
Alternative: At least one rate is not equal.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rexp(150, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) exponential_rate_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rexp(50, 1), rexp(50, 2), rexp(50, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) exponential_rate_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rexp(150, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) exponential_rate_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rexp(50, 1), rexp(50, 2), rexp(50, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) exponential_rate_one_way_test(x, fctr, .95)
Test the rate parameter of an exponential distribution.
exponential_rate_test(x, rate, alternative = "two.sided", conf.level = 0.95)exponential_rate_test(x, rate, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
rate |
a number indicating the tested value of rate. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rexp(100, 1) exponential_rate_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rexp(100, 3) exponential_rate_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rexp(100, 1) exponential_rate_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rexp(100, 3) exponential_rate_test(x, 1, "greater")
Test the equality of rate parameters of gamma distributions.
gamma_rate_one_way_test(x, fctr, conf.level = 0.95)gamma_rate_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All rates are equal. (rate_1 = rate_2 ... rate_k).
Alternative: At least one rate is not equal.
The shapes are treated as nuisance parameters and are estimated separately for each group.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rgamma(150, 1, 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_rate_one_way_test(x, fctr, .95) # Null is false set.seed(5) x <- c(rgamma(50, 2, 1), rgamma(50, 2, 2), rgamma(50, 2, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_rate_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rgamma(150, 1, 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_rate_one_way_test(x, fctr, .95) # Null is false set.seed(5) x <- c(rgamma(50, 2, 1), rgamma(50, 2, 2), rgamma(50, 2, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_rate_one_way_test(x, fctr, .95)
Test the rate parameter of a gamma distribution.
gamma_rate_test(x, rate, alternative = "two.sided", conf.level = 0.95)gamma_rate_test(x, rate, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
rate |
a number indicating the tested value of the rate parameter. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rgamma(100, shape = 1, rate = 1) gamma_rate_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rgamma(100, shape = 1, rate = 2) gamma_rate_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rgamma(100, shape = 1, rate = 1) gamma_rate_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rgamma(100, shape = 1, rate = 2) gamma_rate_test(x, 1, "greater")
Test the equality of scale parameters of gamma distributions.
gamma_scale_one_way_test(x, fctr, conf.level = 0.95)gamma_scale_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All scales are equal. (scale_1 = scale_2 ... scale_k).
Alternative: At least one scale is not equal.
The shapes are treated as nuisance parameters and are estimated separately for each group.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rgamma(150, 1, scale = 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_scale_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rgamma(50, 2, scale = 1), rgamma(50, 2, scale = 2), rgamma(50, 2, scale = 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_scale_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rgamma(150, 1, scale = 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_scale_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rgamma(50, 2, scale = 1), rgamma(50, 2, scale = 2), rgamma(50, 2, scale = 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_scale_one_way_test(x, fctr, .95)
Test the scale parameter of a gamma distribution.
gamma_scale_test(x, scale, alternative = "two.sided", conf.level = 0.95)gamma_scale_test(x, scale, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
scale |
a number indicating the tested value of the scale parameter. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rgamma(100, shape = 1, scale = 2) gamma_scale_test(x, 2, "two.sided") # Null is false set.seed(1) x <- rgamma(100, shape = 1, scale = 2) gamma_scale_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rgamma(100, shape = 1, scale = 2) gamma_scale_test(x, 2, "two.sided") # Null is false set.seed(1) x <- rgamma(100, shape = 1, scale = 2) gamma_scale_test(x, 1, "greater")
Test the equality of shape parameters of gamma distributions.
gamma_shape_one_way_test(x, fctr, conf.level = 0.95)gamma_shape_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All shapes are equal. (shape_1 = shape_2 ... shape_k).
Alternative: At least one shape is not equal.
The rates are treated as nuisance parameters and are estimated separately for each group.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rgamma(150, 2, 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_shape_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rgamma(50, 1, 2), rgamma(50, 2, 2), rgamma(50, 3, 2)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_shape_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rgamma(150, 2, 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_shape_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rgamma(50, 1, 2), rgamma(50, 2, 2), rgamma(50, 3, 2)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gamma_shape_one_way_test(x, fctr, .95)
Test the shape parameter of a gamma distribution.
gamma_shape_test(x, shape, alternative = "two.sided", conf.level = 0.95)gamma_shape_test(x, shape, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
shape |
a number indicating the tested value of the shape parameter. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rgamma(100, shape = 1, scale = 2) gamma_shape_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rgamma(100, shape = 3, scale = 2) gamma_shape_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rgamma(100, shape = 1, scale = 2) gamma_shape_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rgamma(100, shape = 3, scale = 2) gamma_shape_test(x, 1, "greater")
Test the equality of means of gaussian distributions.
gaussian_mu_one_way_test(x, fctr, conf.level = 0.95)gaussian_mu_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All mus are equal. (mu1 = mu2 ... muk).
Alternative: At least one mu is not equal.
The variance is assumed to be equal across all groups.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rnorm(150, 1, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gaussian_mu_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rnorm(50, 1, 1), rnorm(50, 2, 1), rnorm(50, 3, 1)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gaussian_mu_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rnorm(150, 1, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gaussian_mu_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rnorm(50, 1, 1), rnorm(50, 2, 1), rnorm(50, 3, 1)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gaussian_mu_one_way_test(x, fctr, .95)
Test the mean of a gaussian distribution.
gaussian_mu_test(x, mu, alternative = "two.sided", conf.level = 0.95)gaussian_mu_test(x, mu, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
mu |
a number indicating the tested value of mu. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rnorm(100, 0, 1) gaussian_mu_test(x, 0, "two.sided") # Null is false set.seed(1) x <- rnorm(100, 3, 1) gaussian_mu_test(x, 0, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rnorm(100, 0, 1) gaussian_mu_test(x, 0, "two.sided") # Null is false set.seed(1) x <- rnorm(100, 3, 1) gaussian_mu_test(x, 0, "greater")
Test the equality of variance parameters of gaussian distributions.
gaussian_variance_one_way_test(x, fctr, conf.level = 0.95)gaussian_variance_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All variances are equal. (o^2_1 = o^2_2 ... o^2_k).
Alternative: At least one variance is not equal.
The means are treated as nuisance parameters and are estimated separately for each group.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rnorm(150, 1, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gaussian_variance_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rnorm(50, 1, 1), rnorm(50, 1, 2), rnorm(50, 1, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gaussian_variance_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rnorm(150, 1, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gaussian_variance_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rnorm(50, 1, 1), rnorm(50, 1, 2), rnorm(50, 1, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) gaussian_variance_one_way_test(x, fctr, .95)
Test the variance of a gaussian distribution.
gaussian_variance_test( x, sigma.squared, alternative = "two.sided", conf.level = 0.95 )gaussian_variance_test( x, sigma.squared, alternative = "two.sided", conf.level = 0.95 )
x |
a numeric vector of data. |
sigma.squared |
a number indicating the tested value of sigma squared. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rnorm(100, 0, 1) gaussian_variance_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rnorm(100, 0, 2) gaussian_variance_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rnorm(100, 0, 1) gaussian_variance_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rnorm(100, 0, 2) gaussian_variance_test(x, 1, "greater")
Test the equality of dispersion parameters of inverse gaussian distributions.
inverse_gaussian_dispersion_one_way_test(x, fctr, conf.level = 0.95)inverse_gaussian_dispersion_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All dispersion parameters are equal. (dispersion_1 = dispersion_2 ... dispersion_k).
Alternative: At least one dispersion is not equal.
The means are treated as nuisance parameters and are estimated separately for each group.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 150, mean = 1, dispersion = 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_dispersion_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c( rinvgauss(n = 50, mean = 1, dispersion = 1), rinvgauss(n = 50, mean = 1, dispersion = 3), rinvgauss(n = 50, mean = 1, dispersion = 4) ) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_dispersion_one_way_test(x, fctr, .95)library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 150, mean = 1, dispersion = 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_dispersion_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c( rinvgauss(n = 50, mean = 1, dispersion = 1), rinvgauss(n = 50, mean = 1, dispersion = 3), rinvgauss(n = 50, mean = 1, dispersion = 4) ) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_dispersion_one_way_test(x, fctr, .95)
Test the dispersion parameter of an inverse gaussian distribution.
inverse_gaussian_dispersion_test( x, dispersion, alternative = "two.sided", conf.level = 0.95 )inverse_gaussian_dispersion_test( x, dispersion, alternative = "two.sided", conf.level = 0.95 )
x |
a numeric vector of data. |
dispersion |
a number indicating the tested value of the dispersion parameter. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 100, mean = 1, dispersion = 2) inverse_gaussian_dispersion_test(x, 2, "two.sided") # Null is false set.seed(1) x <- rinvgauss(n = 100, mean = 1, dispersion = 2) inverse_gaussian_dispersion_test(x, 1, "greater")library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 100, mean = 1, dispersion = 2) inverse_gaussian_dispersion_test(x, 2, "two.sided") # Null is false set.seed(1) x <- rinvgauss(n = 100, mean = 1, dispersion = 2) inverse_gaussian_dispersion_test(x, 1, "greater")
Test the equality of means of inverse gaussian distributions.
inverse_gaussian_mu_one_way_test(x, fctr, conf.level = 0.95)inverse_gaussian_mu_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All mus are equal. (mu1 = mu2 ... muk).
Alternative: At least one mu is not equal.
The shape parameter is assumed to be equal across all groups.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 150, mean = 1, shape = 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_mu_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c( rinvgauss(n = 50, mean = 1, shape = 2), rinvgauss(n = 50, mean = 2, shape = 2), rinvgauss(n = 50, mean = 3, shape = 2) ) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_mu_one_way_test(x, fctr, .95)library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 150, mean = 1, shape = 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_mu_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c( rinvgauss(n = 50, mean = 1, shape = 2), rinvgauss(n = 50, mean = 2, shape = 2), rinvgauss(n = 50, mean = 3, shape = 2) ) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_mu_one_way_test(x, fctr, .95)
Test the mean of an inverse gaussian distribution.
inverse_gaussian_mu_test(x, mu, alternative = "two.sided", conf.level = 0.95)inverse_gaussian_mu_test(x, mu, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
mu |
a number indicating the tested value of mu. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 100, mean = 1, shape = 2) inverse_gaussian_mu_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rinvgauss(n = 100, mean = 3, shape = 2) inverse_gaussian_mu_test(x, 1, "greater")library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 100, mean = 1, shape = 2) inverse_gaussian_mu_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rinvgauss(n = 100, mean = 3, shape = 2) inverse_gaussian_mu_test(x, 1, "greater")
Test the equality of shape parameters of inverse gaussian distributions.
inverse_gaussian_shape_one_way_test(x, fctr, conf.level = 0.95)inverse_gaussian_shape_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All shapes are equal. (shape_1 = shape_2 ... shape_k).
Alternative: At least one shape is not equal.
The means are treated as nuisance parameters and are estimated separately for each group.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 150, mean = 1, shape = 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_shape_one_way_test(x, fctr, .95) # Null is false set.seed(2) x <- c( rinvgauss(n = 50, mean = 1, shape = 1), rinvgauss(n = 50, mean = 1, shape = 3), rinvgauss(n = 50, mean = 1, shape = 4) ) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_shape_one_way_test(x, fctr, .95)library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 150, mean = 1, shape = 2) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_shape_one_way_test(x, fctr, .95) # Null is false set.seed(2) x <- c( rinvgauss(n = 50, mean = 1, shape = 1), rinvgauss(n = 50, mean = 1, shape = 3), rinvgauss(n = 50, mean = 1, shape = 4) ) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) inverse_gaussian_shape_one_way_test(x, fctr, .95)
Test the shape parameter of an inverse gaussian distribution.
inverse_gaussian_shape_test( x, shape, alternative = "two.sided", conf.level = 0.95 )inverse_gaussian_shape_test( x, shape, alternative = "two.sided", conf.level = 0.95 )
x |
a numeric vector of data. |
shape |
a number indicating the tested value of the shape parameter. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 100, mean = 1, shape = 2) inverse_gaussian_shape_test(x, 2, "two.sided") # Null is false set.seed(1) x <- rinvgauss(n = 100, mean = 1, shape = 2) inverse_gaussian_shape_test(x, 1, "greater")library(LRTesteR) library(statmod) # Null is true set.seed(1) x <- rinvgauss(n = 100, mean = 1, shape = 2) inverse_gaussian_shape_test(x, 2, "two.sided") # Null is false set.seed(1) x <- rinvgauss(n = 100, mean = 1, shape = 2) inverse_gaussian_shape_test(x, 1, "greater")
Test the equality of means of log normal distributions.
log_normal_mu_one_way_test(x, fctr, conf.level = 0.95)log_normal_mu_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All mus are equal. (mu1 = mu2 ... muk).
Alternative: At least one mu is not equal.
The variance of the logged data is assumed to be equal across all groups.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rlnorm(150, 1, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) log_normal_mu_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rlnorm(50, 1, 1), rlnorm(50, 2, 1), rlnorm(50, 3, 1)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) log_normal_mu_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rlnorm(150, 1, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) log_normal_mu_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rlnorm(50, 1, 1), rlnorm(50, 2, 1), rlnorm(50, 3, 1)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) log_normal_mu_one_way_test(x, fctr, .95)
Test the mean of a log normal distribution.
log_normal_mu_test(x, mu, alternative = "two.sided", conf.level = 0.95)log_normal_mu_test(x, mu, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
mu |
a number indicating the tested value of mu. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rlnorm(100, 0, 1) log_normal_mu_test(x, 0, "two.sided") # Null is false set.seed(1) x <- rlnorm(100, 3, 1) log_normal_mu_test(x, 0, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rlnorm(100, 0, 1) log_normal_mu_test(x, 0, "two.sided") # Null is false set.seed(1) x <- rlnorm(100, 3, 1) log_normal_mu_test(x, 0, "greater")
Test the equality of variance parameters of log normal distributions.
log_normal_variance_one_way_test(x, fctr, conf.level = 0.95)log_normal_variance_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All variances are equal. (o^2_1 = o^2_2 ... o^2_k).
Alternative: At least one variance is not equal.
The means of the logged data are treated as nuisance parameters and are estimated separately for each group.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rlnorm(150, 1, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) log_normal_variance_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rlnorm(50, 1, 1), rlnorm(50, 1, 2), rlnorm(50, 1, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) log_normal_variance_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rlnorm(150, 1, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) log_normal_variance_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rlnorm(50, 1, 1), rlnorm(50, 1, 2), rlnorm(50, 1, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) log_normal_variance_one_way_test(x, fctr, .95)
Test the variance of a log normal distribution.
log_normal_variance_test( x, sigma.squared, alternative = "two.sided", conf.level = 0.95 )log_normal_variance_test( x, sigma.squared, alternative = "two.sided", conf.level = 0.95 )
x |
a numeric vector of data. |
sigma.squared |
a number indicating the tested value of sigma squared. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rlnorm(100, 0, 1) log_normal_variance_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rlnorm(100, 0, 2) log_normal_variance_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rlnorm(100, 0, 1) log_normal_variance_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rlnorm(100, 0, 2) log_normal_variance_test(x, 1, "greater")
Test the equality of prob parameters of negative binomial distributions.
negative_binomial_prob_one_way_test( num_failures, num_successes, fctr, conf.level = 0.95 )negative_binomial_prob_one_way_test( num_failures, num_successes, fctr, conf.level = 0.95 )
num_failures |
a numeric vector indicating number of failures per group. |
num_successes |
a numeric vector indicating number of successes per group. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All probs are equal. (prob_1 = prob_2 ... prob_k).
Alternative: At least one prob is not equal.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true. set.seed(1) num_failures <- rnbinom(3, 50, .5) num_successes <- rep(50, length(num_failures)) fctr <- factor(1:length(num_failures)) negative_binomial_prob_one_way_test(num_failures, num_successes, fctr, .95) # Null is false set.seed(1) num_failures <- rnbinom(3, 50, c(.25, .50, .75)) num_successes <- rep(50, length(num_failures)) fctr <- factor(1:length(num_failures)) negative_binomial_prob_one_way_test(num_failures, num_successes, fctr, .95)library(LRTesteR) # Null is true. set.seed(1) num_failures <- rnbinom(3, 50, .5) num_successes <- rep(50, length(num_failures)) fctr <- factor(1:length(num_failures)) negative_binomial_prob_one_way_test(num_failures, num_successes, fctr, .95) # Null is false set.seed(1) num_failures <- rnbinom(3, 50, c(.25, .50, .75)) num_successes <- rep(50, length(num_failures)) fctr <- factor(1:length(num_failures)) negative_binomial_prob_one_way_test(num_failures, num_successes, fctr, .95)
Test the prob parameter of a negative binomial distribution.
negative_binomial_prob_test( num_failures, num_successes, prob, alternative = "two.sided", conf.level = 0.95 )negative_binomial_prob_test( num_failures, num_successes, prob, alternative = "two.sided", conf.level = 0.95 )
num_failures |
Number of failures. |
num_successes |
Number of successes. |
prob |
Hypothesized probability of success. |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true. 48 failures before 52 successes. negative_binomial_prob_test(48, 52, .50, "two.sided") # Null is false. 25 failures before 75 successes. negative_binomial_prob_test(25, 75, .50, "two.sided")library(LRTesteR) # Null is true. 48 failures before 52 successes. negative_binomial_prob_test(48, 52, .50, "two.sided") # Null is false. 25 failures before 75 successes. negative_binomial_prob_test(25, 75, .50, "two.sided")
Test the equality of lambda parameters of poisson distributions.
poisson_lambda_one_way_test(x, fctr, conf.level = 0.95)poisson_lambda_one_way_test(x, fctr, conf.level = 0.95)
x |
a numeric vector of data. |
fctr |
a factor vector indicating groups. |
conf.level |
overall confidence level of the likelihood intervals. Uses Bonferroni correction. |
Null: All lambdas are equal. (lambda_1 = lambda_2 ... lambda_k).
Alternative: At least one lambda is not equal.
An S3 class containing the test statistic, p value, list of likelihood based confidence intervals, overall confidence level, individual confidence level of each interval and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rpois(150, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) poisson_lambda_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rpois(50, 1), rpois(50, 2), rpois(50, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) poisson_lambda_one_way_test(x, fctr, .95)library(LRTesteR) # Null is true set.seed(1) x <- rpois(150, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) poisson_lambda_one_way_test(x, fctr, .95) # Null is false set.seed(1) x <- c(rpois(50, 1), rpois(50, 2), rpois(50, 3)) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) poisson_lambda_one_way_test(x, fctr, .95)
Test the lambda parameter of a poisson distribution.
poisson_lambda_test(x, lambda, alternative = "two.sided", conf.level = 0.95)poisson_lambda_test(x, lambda, alternative = "two.sided", conf.level = 0.95)
x |
a numeric vector of data. |
lambda |
a number indicating the tested value of lambda |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
conf.level |
confidence level of the likelihood interval. |
An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.
Yudi Pawitan. In All Likelihood. Oxford University Press.
Hogg, McKean, and Craig. Introduction to Mathematical Statistics. Pearson.
library(LRTesteR) # Null is true set.seed(1) x <- rpois(100, 1) poisson_lambda_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rpois(100, 2) poisson_lambda_test(x, 1, "greater")library(LRTesteR) # Null is true set.seed(1) x <- rpois(100, 1) poisson_lambda_test(x, 1, "two.sided") # Null is false set.seed(1) x <- rpois(100, 2) poisson_lambda_test(x, 1, "greater")
Print results of tests.
## S3 method for class 'lrtest' print(x, ...)## S3 method for class 'lrtest' print(x, ...)
x |
a test from LRTesteR. |
... |
arguments passed to other methods. |
x, invisibly. Called for the side effect of printing the test.
library(LRTesteR) set.seed(1) x <- rnorm(100, 0, 1) test <- gaussian_mu_test(x, 0, "two.sided") print(test) set.seed(1) x <- rnorm(150, 1, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) test <- gaussian_mu_one_way_test(x, fctr, .95) print(test)library(LRTesteR) set.seed(1) x <- rnorm(100, 0, 1) test <- gaussian_mu_test(x, 0, "two.sided") print(test) set.seed(1) x <- rnorm(150, 1, 1) fctr <- c(rep(1, 50), rep(2, 50), rep(3, 50)) fctr <- factor(fctr, levels = c("1", "2", "3")) test <- gaussian_mu_one_way_test(x, fctr, .95) print(test)