The Wrapped Two-Piece Exponential Power Distribution

The two-piece exponential power distribution on the line (Fernández and Steel, 1998, ) and its wrapped version on the circle, treated as a uniform scale mixture with generalised gamma mixing (Ehlers, 2015, ). Given the mixing variable, the variable is uniform on an interval that contains the location. The package name follows the authors' earlier usage, the wrapped skew generalised normal distribution. Density, distribution and quantile functions, random generation from the mixture, and the characteristic function and trigonometric moments for every shape parameter, evaluated on a rotated path of integration, with the convergent series as a check. The wrapped density adds an Euler-Maclaurin tail to the image sum, so small shapes are covered. Maximum likelihood fitting of the four-parameter wrapped distribution under a lower bound on the shape, over both the regular and the spike branch, with the location searched over the observations when the shape is at most one; the grouped likelihood for rounded data; profile likelihoods; and standard errors from the expected information or a parametric bootstrap. A pure-C back-end does the numerics and also backs the 'Python' package 'wsgnstat'.


wsgnstat

R-CMD-check CRANstatus

The two-piece exponential power distribution on the line and its wrapped version on the circle, treated as a uniform scale mixture with generalised gamma mixing. The package name keeps the authors’ earlier one, the wrapped skew generalised normal distribution. It provides density, distribution and quantile functions and random generation, the characteristic function and the trigonometric moments for every shape parameter, and maximum likelihood fitting of the four-parameter wrapped distribution under a lower bound on the shape, or by the grouped likelihood for rounded data. The computation runs on a pure-C back-end shared with the Python package of the same name.

Installation

From CRAN:

install.packages("wsgnstat")

The development version from GitHub:

# install.packages("remotes")
remotes::install_github("mtloots/wsgnstat", subdir = "wsgnstat")

Example

Simulate from a skew member of the four-parameter wrapped distribution, fit it by maximum likelihood, and compare with the truth; at a fitted shape above one the standard errors come from the expected Fisher information:

library(wsgnstat)
set.seed(1)
theta <- rwsgn(200, mu = 1, beta = 1.6, lam = 0.3, sigma = 0.4)
fit <- fit_wsgn(theta)
round(rbind(truth = c(1, 0.4, 0.3, 1.6), estimate = coef(fit), se = fit$se), 3)
#>             mu sigma   lam  beta
#> truth    1.000 0.400 0.300 1.600
#> estimate 1.095 0.402 0.318 1.732
#> se       0.106 0.054 0.046 0.263

The characteristic function is computed for every shape, so it equals one at zero also for small shapes, and at shape 2 with lam = 0.5 it is the normal characteristic function exp(-sigma^2 t^2):

sapply(c(0.1, 0.3, 1, 2), function(b) Mod(cfsgn(0, 0, 0.4, b, 0.3, 0.7) - 1))
#> [1] 0 0 0 0
t <- 1:4
rbind(engine = Re(cfsgn(t, 0, 0.4, 2, 0.5, 0.5)), closed_form = exp(-0.16 * t^2))
#>                  [,1]      [,2]      [,3]       [,4]
#> engine      0.8521438 0.5272924 0.2369278 0.07730474
#> closed_form 0.8521438 0.5272924 0.2369278 0.07730474

Rounded data are fitted by the grouped likelihood over the recording cells; here the directions are recorded to 10 degrees:

h <- pi / 18
theta10 <- (round(theta / h) * h) %% (2 * pi)
coef(fit_wsgn(theta10, resolution = h, se = "none"))
#>        mu     sigma       lam      beta 
#> 1.0800109 0.3963098 0.3124758 1.7239484

The vignette, vignette("wsgnstat"), treats the mixture representation, the characteristic function for small and large shapes, the accuracy of the wrapped density, the fit with its shape floor on wind directions, and the grouped likelihood for rounded ant directions.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("wsgnstat")

0.1.1 by M. Theodor Loots, 12 days ago


https://github.com/mtloots/wsgnstat


Report a bug at https://github.com/mtloots/wsgnstat/issues


Browse source code at https://github.com/cran/wsgnstat


Authors: M. Theodor Loots [aut, cre, cph] (ORCID:


Documentation:   PDF Manual  


GPL-3 license


Imports stats

Suggests circular, knitr, rmarkdown, testthat


See at CRAN