Learn R Programming

LeArEst (version 1.0.0)

lengthest: Performs width estimation for a numerical data set.

Description

Function lengthest() computes the length of an interval which is the domain of uniform distribution from data contaminated with additive error. The additive error can be chosen as Laplace, Gauss or scaled Student distribution with 1 - 5 degrees of freedom.

Usage

lengthest(x, error = c("laplace", "gauss", "t1", "t2", "t3", "t4", "t5"),
  sd = NULL, sd.est = c("MM", "ML"), conf.level = 0.95)

Arguments

x

Vector of input data.

error

A character string specifying the error distribution. Must be one of "laplace", "gauss", "t1", "t2", "t3", "t4", "t5". Can be abbreviated.

sd

Explicit error standard deviation. Needs to be given if sd.est is not given.

sd.est

A character string specifying the method of error standard deviation estimation. Must be given if sd is not given. Can be "MM" (Method of Moments) or "ML" (Maximum Likelihood).

conf.level

Confidence level of the confidence interval.

Value

List containing:

  • error.type: A character string describing the type of the error distribution.

  • radius: Estimated half-width of uniform distribution.

  • sd.error: Error standard deviation, estimated or given.

  • conf.level: Confidence level of the confidence interval.

  • method: A character string indicating what method for computing a confidence interval was used (asymptotic distribution of ML or likelihood ratio statistic).

  • conf.int: The confidence interval for half-width.

Examples

Run this code
# NOT RUN {
# generate uniform data with additive error and run a length estimation on it
sample_1 <- runif(1000, -1, 1)
sample_2 <- rnorm(1000, 0, 0.1)
sample <- sample_1 + sample_2
out <- lengthest(x = sample, error = "gauss", sd.est = "MM", conf.level = 0.90)

# }

Run the code above in your browser using DataLab