Function lengthtest() tests the hypothesized uniform domain width against two-sided or one-sided alternatives 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.
error: A character string specifying the error distribution. Must be one of "laplace", "gauss", "t1", "t2", "t3", "t4", "t5". Can be abbreviated.
alternative: A character string specifying the alternative hypothesis, must be one of "two.sided", "greater" or "less". Can be abbreviated.
sd: Explicit error standard deviation. Needs to be given if var.sd is not given.
null.a: Specified null value being tested.
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.
Returns
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,
alternative: A character string describing the alternative hypothesis,
method: A character string indicating what method for testing was used (asymptotic distribution of MLE or likelihood ratio statistic),
conf.int: The confidence interval for half-width,
null.a: null value being tested,
p.value: p-value of the test,
tstat: the value of the test statistic.
Examples
# generate uniform data with additive error and run a hypothesis testing on itsample_1 <- runif(1000,-1,1)sample_2 <- rnorm(1000,0,0.1)sample <- sample_1 + sample_2
out <- lengthtest(x = sample, error ="gauss", alternative ="greater", sd.est ="MM", null.a =0.997, conf.level =0.95)