empirical_quantile_one_sample {LRTesteR}R Documentation

Test a quantile of an unknown distribution.

Description

Test a quantile of an unknown distribution.

Usage

empirical_quantile_one_sample(
  x,
  Q,
  value,
  alternative = "two.sided",
  conf.level = 0.95
)

Arguments

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.

Details

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.

Value

An S3 class containing the test statistic, p value, likelihood based confidence interval, and alternative hypothesis.

Source

Examples

library(LRTesteR)

# Null is true
set.seed(1)
x <- rnorm(25, 0, 1)
empirical_quantile_one_sample(x, .5, 0, "two.sided")

# Null is false
set.seed(1)
x <- rnorm(25, 2, 1)
empirical_quantile_one_sample(x, .5, 1, "greater")

[Package LRTesteR version 1.1.1 Index]