Learn R Programming

goft (version 1.3.6)

laplace_test: Tests for the Laplace or double exponential distribution

Description

Transformation and ratio tests for the Laplace distribution by Gonzalez-Estrada and Villasenor (2016).

Usage

laplace_test(x, method = "transf", N = 10^5)

Arguments

x

a numeric data vector containing a random sample of real numbers.

method

the type of test to be performed. Two available options are "transf" and "ratio". Default option is "transf".

N

number of Monte Carlo samples used to approximate the p-value of the test when the "ratio" option is chosen and the sample size is less than 500. Default is N = 10^5.

Value

A list with class "htest" containing the following components.

statistic

the calculated value of the test statistic.

p.value

approximated p-value of the test.

method

a character string giving the name of the method used for testing the null hypothesis.

data.name

a character string giving the name of the data set.

Details

When "transf" option is chosen, a transformation to approximately exponential random variables is performed and the exponentiality hypothesis is assessed using Anderson-Darling test.

When "ratio" option is chosen, a test based on the ratio of two estimators of the scale parameter is performed. For samples of size n < 500, the p-value of this test is approximated by Monte Carlo simulation. Otherwise, it is approximated by the standard normal cumulative distribution function.

References

Gonzalez-Estrada, E. and Villasenor, J.A. (2016). A ratio goodness-of-fit test for the Laplace distribution. Statistics and Probability Letters, 119, 30-35. https://doi.org/10.1016/j.spl.2016.07.003

Examples

Run this code
# NOT RUN {
# Example 1:  testing the Laplace distribution hypothesis using "transf" option
x <- rnorm(50)   # simulating a random sample from a normal distribution
laplace_test(x)    

# Example 2: testing the Laplace distribution hypothesis using "ratio" option
x <- rt(60,4)    # simulating a random sample from Student's t distribution with 4 d.f.
laplace_test(x, method = "ratio")

# }

Run the code above in your browser using DataLab