Learn R Programming

LambertW (version 0.6.9-1)

test_symmetry: Test symmetry based on Lambert W heavy tail(s)

Description

Performs a test for the null hypothesis of symmetry, \(H_0: \delta_l = \delta_r\), versus the alternative of asymmetry. This can be done using a Wald test of the linear restriction \(H_0: \delta_l - \delta_r = 0\) or a likelihood ratio test.

By default it uses "Wald" test since this only requires the Hessian of the "hh" Lambert W fit. The "LR" test requires the log-likelihood values for both MLEs (type "h" and "hh") and thus takes longer to compute.

Usage

test_symmetry(LambertW.fit, method = c("Wald", "LR"))

Value

A list of class "htest" containing:

statistic

value of the test statistic,

p.value

p-value for the test,

method

character string describing the test,

data.name

a character string giving the name(s) of the data.

Arguments

LambertW.fit

an object of class LambertW_fit with type = "hh" or a numeric vector (observed data). If it is data, then an asymmetric Lambert W \(\times\) Gaussian distribution (distname = "normal") with two tail parameters ("hh") will be fit to the data internally and then used as the new LambertW.fit.

method

test methodology: "Wald" (default) or a likelihood ratio "LR" test

Examples

Run this code

if (FALSE) {
# skewed
yy <- rLambertW(n = 500, theta = list(delta = c(0.1, 0.25), beta = c(2, 1)), 
                distname = "normal")
fit.ml <- MLE_LambertW(yy, type = "hh", distname = "normal", 
                       hessian = TRUE)
summary(fit.ml)
test_symmetry(fit.ml, "LR")
test_symmetry(fit.ml, "Wald")

# symmetric 
yy <- rLambertW(n = 500, theta = list(delta = c(0.2, 0.2), beta = c(2, 1)), 
                distname = "normal")
fit.ml <- MLE_LambertW(yy, type = "hh", distname = "normal")
summary(fit.ml)
test_symmetry(fit.ml, "LR")
test_symmetry(fit.ml, "Wald")
}

Run the code above in your browser using DataLab