Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


LambertW (version 0.6.9-1)

beta-utils: Utilities for parameter vector beta of the input distribution

Description

The parameter β specifies the input distribution XFX(xβ).

beta2tau converts β to the transformation vector τ=(μx,σx,γ=0,α=1,δ=0), which defines the Lambert W× F random variable mapping from X to Y (see tau-utils). Parameters μx and σx of X in general depend on β (and may not even exist for use.mean.variance = TRUE; in this case beta2tau will throw an error).

check_beta checks if β defines a valid distribution, e.g., for normal distribution 'sigma' must be positive.

estimate_beta estimates β for a given FX using MLE or methods of moments. Closed form solutions are used if they exist; otherwise the MLE is obtained numerically using fitdistr.

get_beta_names returns (typical) names for each component of β.

Depending on the distribution β has different length and names: e.g., for a "normal" distribution beta is of length 2 ("mu", "sigma"); for an "exp"onential distribution beta is a scalar (rate "lambda").

Usage

beta2tau(beta, distname, use.mean.variance = TRUE)

check_beta(beta, distname)

estimate_beta(x, distname)

get_beta_names(distname)

Value

beta2tau returns a numeric vector, which is τ=τ(β) implied by beta and distname.

check_beta throws an error if β is not appropriate for the given distribution; e.g., if it has too many values or if they are not within proper bounds (e.g., beta['sigma'] of a

"normal" distribution must be positive).

estimate_beta returns a named vector with estimates for β given x.

get_beta_names returns a vector of characters.

Arguments

beta

numeric; vector β of the input distribution; specifications as they are for the R implementation of this distribution. For example, if distname = "exp", then beta = 2 means that the rate of the exponential distribution equals 2; if distname = "normal" then beta = c(1,2) means that the mean and standard deviation are 1 and 2, respectively.

distname

character; name of input distribution; see get_distnames.

use.mean.variance

logical; if TRUE it uses mean and variance implied by β to do the transformation (Goerg 2011). If FALSE, it uses the alternative definition from Goerg (2016) with location and scale parameter.

x

a numeric vector of real values (the input data).

Details

estimate_beta does not do any data transformation as part of the Lambert W× F input/output framework. For an initial estimate of θ for Lambert W× F distributions see get_initial_theta and get_initial_tau.

A quick initial estimate of θ is obtained by first finding the (approximate) input x^θ^ by IGMM, and then getting the MLE of β for this input data x^θ^FX(xβ) (usually using fitdistr).

See Also

tau-utils, theta-utils

Examples

Run this code
# By default: delta = gamma = 0 and alpha = 1
beta2tau(c(1, 1), distname = "normal") 
if (FALSE) {
  beta2tau(c(1, 4, 1), distname = "t")
}
beta2tau(c(1, 4, 1), distname = "t", use.mean.variance = FALSE)
beta2tau(c(1, 4, 3), distname = "t") # no problem


if (FALSE) {
check_beta(beta = c(1, 1, -1), distname = "normal")
}


set.seed(124)
xx <- rnorm(100)^2
estimate_beta(xx, "exp")
estimate_beta(xx, "chisq")

Run the code above in your browser using DataLab