Lambert W x F distributions are a generalized framework to analyze skewed, heavy-tailed data. It is based on an input/output system, where the output random variable (RV) Y is a non-linearly transformed version of an input RV X ~ F with similar properties as X, but slightly skewed (heavy-tailed). The transformed RV Y has a Lambert W x F distribution. This package contains functions to model and analyze skewed, heavy-tailed data the Lambert Way: simulate random samples, estimate parameters, compute quantiles, and plot/ print results nicely. Probably the most important function is 'Gaussianize', which works similarly to 'scale', but actually makes the data Gaussian. A do-it-yourself toolkit allows users to define their own Lambert W x 'MyFavoriteDistribution' and use it in their analysis right away.
skewness.cpp
rewrote a couple of functions in C++ using the amazing (!) Rcpp package.
3-4x speed up for W
related functions; also for IGMM
and MLE_LambertW
added bootstrap functions for users to easily check if a Lambert W x F distribution with finite mean and variance input makes sense:
bootstrap.LambertW_fit
analyze_convergence
added use.mean.variance
argument to distinguish between mean-variance
Lambert W x F distributions and general location-scale Lambert W x F
distributions. See also Goerg (2015b). See the help file on these functions for references on why they were included.
added more unit tests (moving code from "Examples" to unit tests)
theta
argument in the dpqr
function becomes the recommended argument to
specify the distribution. alpha
, beta
, gamma
, delta
now give
warnings and will be deprecated in future versions.gamma_Taylor
for better initial estimates.skewness()
and kurtosis()
instead directly in LambertW.moved from gsl to lamW R package: the Lambert W implementation is ~4x faster than for gsl. Needless to say that this will also speed up many computations in the LambertW package. Thank you Avraham Adler for the lamW package.
new functions:
deriv_xexp()
normalize_by_tau()
log_deriv_W()
lots of performance improvements (not only due to lamW package). Leads to 2-3x faster estimation via IGMM or MLE overall.
added (first iteration) of unit tests using the testthat package
NAMESPACE
following new CRAN policiesfrom = 0
in plot.LambertW_fit
for scale families with all positive values.get_distname_family
returns a third logical entry non.negative
to
check whether a distribution is for non-negative random variables (e.g.,
exponential or Gamma).loglik_penalty
loses the "distname" argument, but gains the
"is.non.negative" argument.any(is.na(...))
with anyNA(...)
(small speedups)deriv_W
faster and more precise using a log transform first and
using mathematial identities of the derivative of W, its derivative, and
logarithm.delta_GMM
and gamma_GMM
(it's about 30% faster than "nlm")delta_GMM
: for delta
too large (>1e100
) the backtransformed data u
would
become negligibly small and numerically a constant (1e-100
); thus
kurtosis()
estimate would be NaN
, which resulted in stop of nlm
function in delta_GMM
. Added an NA
check and returned large value
for objective function, for nlm()
to search for a better delta
.
backtransformedget_initial_theta
: if initial estimates of gamma
are too extreme, then
the backtransformed input data for X contains NA
. This caused an error
in estimate_beta()
. Now NA
s are removed before passing x.init
to estimate_beta()
log_W(Inf)
returned NA
; fixed to return Inf
.qLambertW()
didn't compute correct quantiles for non-negative distributions
(e.g., "exp"
or "gamma"
) and type = "s"
; replaced now with closed form
expressions.See also ?deprecated-function
:
H()
: use xexp()
insteaddata
input to Gaussianize()
does not have to have colnames
; will
be assigned by default if colnames(data) = NULL
mLambertW
which ignored delta
values passed via theta
Several deprecated functions (see also ?deprecated-function
):
normfit()
: use test_normality()
(or short test_norm()
) insteadgrid
to test_normality
(previously known as normfit
)Version 0.5 is a long awaited - big - update to the LambertW package. That's why it's a big bump from 0.2.9.9 to 0.5.
It has lots of improved code, bug fixes, more user friendly function (names) and implementation, more explicit error checking and meaningful error messages, etc.
Definitely check out the new manual - it has been reviewed very thoroughly.
W()
(and related functions) gained a branch
argument (see also deprecated functions below).Gaussianize()
gained several new arguments that allow to do the inverse
''DeGaussianization'' as well. See ?Gaussianize
for details.check_beta()
check_distname()
check_tau()
deriv_W_gamma()
estimate_beta()
get_distname_family()
get_distnames()
get_gamma_bounds()
get_initial_tau()
get_output()
(due to popular demand)log_W()
tau2theta()
NEWS
fileCITATION
file. See citation information with citation("LambertW")
FALSE
).theta
as argument in functions instead of alpha
, beta
, gamma
, or
delta
. Passing the elements as single arguments still works, but using
theta = list(beta = ..., gamma = ..., delta = ..., alpha = ...)
is preferred.
In future versions the alpha
, beta
, gamma
, and delta
arguments will be deprecated.normfit()
:
_
as separator in function names=
to <-
_
to .
(unless it _
helps understanding; e.g.,mu_y
reminds of mu
with the y
subscript in LaTeX / pdf)get_initial_theta()
instead of starting_theta()
; get_support()
instead of support()
)normfit
is often called for visual checks only, I made the normality tests optional. They are called if the nortest package is available (require(nortest) == TRUE
); otherwise
it just returns NA
. This is useful in case users do not have the nortest package available
in their R installation.qU()
and pU()
: incorrect usage of standard deviation vs scale in t distribution (dU()
and thus log-likelihood was correct).ks.test.t
now uses the scale parameter, rather than standard deviation. This now
allows to test also if degrees of freedom < 2.MLE_LambertW
changed the estimate.only
argument to return.estimate.only
.Several deprecated functions (see also ?deprecated-function
):
beta_names()
: use get_beta_names()
bounds_theta()
: use get_theta_bounds()
d1W()
and d1W_1()
: use deriv_W(..., branch)
.d1W_delta()
, d1W_delta_alpha()
: use deriv_W_delta()
and deriv_W_delta_alpha()
.get.input()
: use get_input()
p_1()
: use p_1m()
params2theta()
: use unflatten_theta()
skewness_test()
: use test_symmetry()
starting_theta()
: use get_initial_theta()
support()
: use get_support()
theta2params()
: use flatten_theta()
vec.norm()
: use lp_norm()
W_1()
: use W(z, branch = -1)
; similarly for W_gamma_1()
W_2delta_alpha()
: use W_2delta_2alpha()
.W_gamma_1()
: use W_gamma(..., branch = -1)
.G()
since it was never used. If you need it use G_delta(z, delta = 0)
.MLE_LambertW_new()
and (MLE_LambertW_new.default()
); MLE_LambertW
now works also for unbounded optimziation..default
methods for IGMM
and MLE_LambertW
. They just work one way on a numeric vector.optim(..., hessian = TRUE)
instead.im@gmge.org
get.input()
had the wrong variable for nu > 2
(u
instead of uu
)loglik_penalty()
returned NA
for 0/0
when computing inverse transformation.
Replaced this term with equivalent expression avoiding 0/0
.im@gmge.org
)