Last data update: 2014.03.03

R: Iterative Generalized Method of Moments - IGMM
IGMMR Documentation

Iterative Generalized Method of Moments – IGMM

Description

An iterative method of moments estimator to find this τ = (μ_x, σ_x, γ) for type = 's' (τ = (μ_x, σ_x, δ) for type = 'h' or τ = (μ_x, σ_x, δ_l, δ_r) for type = "hh") which minimizes the distance between the sample and theoretical skewness (or kurtosis) of oldsymbol x and X.

This algorithm is only well-defined for data with finite mean and variance input X. See analyze_convergence and references therein for details.

Usage

IGMM(y, type = c("h", "hh", "s"), skewness.x = 0, kurtosis.x = 3,
  tau.init = get_initial_tau(y, type), robust = FALSE,
  tol = .Machine$double.eps^0.25, location.family = TRUE,
  not.negative = NULL, max.iter = 100, delta.lower = -1,
  delta.upper = 3)

Arguments

y

a numeric vector of real values.

type

type of Lambert W \times F distribution: skewed "s"; heavy-tail "h"; or skewed heavy-tail "hh".

skewness.x

theoretical skewness of input X; default 0 (symmetric distribution).

kurtosis.x

theoretical kurtosis of input X; default 3 (Normal distribution reference).

tau.init

starting values for IGMM algorithm; default: get_initial_tau. See also gamma_Taylor and delta_Taylor.

robust

logical; only used for type = "s". If TRUE a robust estimate of asymmetry is used (see medcouple_estimator); default: FALSE.

tol

a positive scalar specifiying the tolerance level for terminating the iterative algorithm. Default: .Machine$double.eps^0.25

location.family

logical; tell the algorithm whether the underlying input should have a location family distribution (for example, Gaussian input); default: TRUE. If FALSE (e.g., for "exp"onential input), then tau['mu_x'] = 0 throughout the optimization.

not.negative

logical; if TRUE, the estimate for γ or δ is restricted to non-negative reals. If it is set to NULL (default) then it will be set internally to TRUE for heavy-tail(s) Lambert W \times F distributions (type = "h" or "hh"). For skewed Lambert W \times F (type = "s") it will be set to FALSE, unless it is not a location-scale family (see get_distname_family).

max.iter

maximum number of iterations; default: 100.

delta.lower, delta.upper

lower and upper bound for delta_GMM optimization. By default: -1 and 3 which covers most real-world heavy-tail scenarios.

Details

For algorithm details see the References.

Value

A list of class LambertW_fit:

tol

see Arguments

data

data y

n

number of observations

type

see Arguments

tau.init

starting values for τ

tau

IGMM estimate for τ

tau.trace

entire iteration trace of τ^{(k)}, k = 0, ..., K, where K <= max.iter.

sub.iterations

number of iterations only performed in GMM algorithm to find optimal γ (or δ)

iterations

number of iterations to update μ_x and σ_x. See References for detals.

hessian

Hessian matrix (obtained from simulations; see References)

call

function call

skewness.x, kurtosis.x

see Arguments

distname

a character string describing distribution characteristics given the target theoretical skewness/kurtosis for the input. Same information as skewness.x and kurtosis.x but human-readable.

location.family

see Arguments

message

message from the optimization method. What kind of convergence?

method

estimation method; here: "IGMM"

Author(s)

Georg M. Goerg

See Also

delta_GMM, gamma_GMM, analyze_convergence

Examples


# estimate tau for the skewed version of a Normal
y <- rLambertW(n = 1000, theta = list(beta = c(2, 1), gamma = 0.2), 
               distname = "normal")
fity <- IGMM(y, type = "s")
fity
summary(fity)
plot(fity)

# estimate tau for the skewed version of an exponential
y <- rLambertW(n = 1000, theta = list(beta = 1, gamma = 0.5), 
               distname = "exp")
fity <- IGMM(y, type = "s", skewness.x = 2, location.family = FALSE)
fity
summary(fity)
plot(fity)

# estimate theta for the heavy-tailed version of a Normal = Tukey's h
y <- rLambertW(n = 500, theta = list(beta = c(2, 1), delta = 0.2), 
               distname = "normal")
system.time(
fity <- IGMM(y, type = "h")
)
fity
summary(fity)
plot(fity)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(LambertW)
Loading required package: MASS
Loading required package: ggplot2
This is 'LambertW' version 0.6.4.  Please see the NEWS file and citation("LambertW").

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LambertW/IGMM.Rd_%03d_medium.png", width=480, height=480)
> ### Name: IGMM
> ### Title: Iterative Generalized Method of Moments - IGMM
> ### Aliases: IGMM
> ### Keywords: iteration optimize
> 
> ### ** Examples
> 
> 
> # estimate tau for the skewed version of a Normal
> y <- rLambertW(n = 1000, theta = list(beta = c(2, 1), gamma = 0.2), 
+                distname = "normal")
> fity <- IGMM(y, type = "s")
> fity
Call: IGMM(y = y, type = "s")
Estimation method:  IGMM 
Input distribution:  Any distribution with finite mean & variance and skewness = 0. 
mean-variance Lambert W x F type ('h' same tails; 'hh' different tails; 's' skewed):  s 

 Parameter estimates:
     mu_x   sigma_x     gamma 
1.9944387 1.0167830 0.1910583 

 Obtained after 6 iterations.
> summary(fity)
Call: IGMM(y = y, type = "s")
Estimation method: IGMM
Input distribution: Any distribution with finite mean & variance and skewness = 0.

 Parameter estimates:
 Note: standard errors are only asymptotic, simulation based.
 If you want more accurate estimates see ?bootstrap .         Estimate  Std. Error  t value  Pr(>|t|)    
mu_x     1.994439    0.031623   63.070 < 2.2e-16 ***
sigma_x  1.016783    0.022361   45.472 < 2.2e-16 ***
gamma    0.191058    0.012649   15.104 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
-------------------------------------------------------------- 
                    a        b
Support    0.03664074      Inf
Data range 0.29364897 7.511299

 p_m1 = P(non-principal branch affects solution): NA
-------------------------------------------------------------- 

Given these input parameter estimates the moments of the output random variable are 
  (assuming Gaussian input): 
 mu_y = 2.19; sigma_y = 1.11; skewness = 1.18; kurtosis = 5.43.

> plot(fity)
> 
> # estimate tau for the skewed version of an exponential
> y <- rLambertW(n = 1000, theta = list(beta = 1, gamma = 0.5), 
+                distname = "exp")
> fity <- IGMM(y, type = "s", skewness.x = 2, location.family = FALSE)
> fity
Call: IGMM(y = y, type = "s", skewness.x = 2, location.family = FALSE)
Estimation method:  IGMM 
Input distribution:  Any distribution with finite mean & variance and skewness = 2. 
mean-variance Lambert W x F type ('h' same tails; 'hh' different tails; 's' skewed):  s 

 Parameter estimates:
     mu_x   sigma_x     gamma 
0.0000000 0.9677755 0.5324075 

 Obtained after 5 iterations.
> summary(fity)
Call: IGMM(y = y, type = "s", skewness.x = 2, location.family = FALSE)
Estimation method: IGMM
Input distribution: Any distribution with finite mean & variance and skewness = 2.

 Parameter estimates:
 Note: standard errors are only asymptotic, simulation based.
 If you want more accurate estimates see ?bootstrap .         Estimate  Std. Error  t value Pr(>|t|)    
mu_x     0.000000    0.031623     0.00        1    
sigma_x  0.967776    0.022361    43.28   <2e-16 ***
gamma    0.532407    0.012649    42.09   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
-------------------------------------------------------------- 
                       a        b
Support    -0.6687072242      Inf
Data range  0.0004525873 689.0179

 p_m1 = P(non-principal branch affects solution): NA
-------------------------------------------------------------- 

Given these input parameter estimates the moments of the output random variable are 
  (assuming Gaussian input): 
 mu_y = 0.59; sigma_y = 1.78; skewness = 4.06; kurtosis = 38.74.

> plot(fity)
> 
> # estimate theta for the heavy-tailed version of a Normal = Tukey's h
> y <- rLambertW(n = 500, theta = list(beta = c(2, 1), delta = 0.2), 
+                distname = "normal")
> system.time(
+ fity <- IGMM(y, type = "h")
+ )
   user  system elapsed 
  0.024   0.000   0.024 
> fity
Call: IGMM(y = y, type = "h")
Estimation method:  IGMM 
Input distribution:  Any distribution with finite mean & variance and kurtosis = 3. 
mean-variance Lambert W x F type ('h' same tails; 'hh' different tails; 's' skewed):  h 

 Parameter estimates:
     mu_x   sigma_x     delta 
1.9764714 1.0117192 0.1729111 

 Obtained after 4 iterations.
> summary(fity)
Call: IGMM(y = y, type = "h")
Estimation method: IGMM
Input distribution: Any distribution with finite mean & variance and kurtosis = 3.

 Parameter estimates:
 Note: standard errors are only asymptotic, simulation based.
 If you want more accurate estimates see ?bootstrap .         Estimate  Std. Error  t value  Pr(>|t|)    
mu_x     1.976471    0.044721  44.1952 < 2.2e-16 ***
sigma_x  1.011719    0.031623  31.9934 < 2.2e-16 ***
delta    0.172911    0.044721   3.8664 0.0001104 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
-------------------------------------------------------------- 

Given these input parameter estimates the moments of the output random variable are 
  (assuming Gaussian input): 
 mu_y = 1.98; sigma_y = 1.39; skewness = 0; kurtosis = 15.91.

> plot(fity)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>