Last data update: 2014.03.03

R: Edgeworth Approximation
edgeworthR Documentation

Edgeworth Approximation

Description

Computes the Edgeworth expansion of either the standardized mean, the mean or the sum of i.i.d. random variables.

Usage

edgeworth(x, n, rho3, rho4, mu, sigma2, deg=3,
          type = c("standardized", "mean", "sum"))

Arguments

x

a numeric vector or array giving the values at which the approximation should be evaluated.

n

a positive integer giving the number of i.i.d. random variables in the sum.

rho3

a numeric value giving the standardized 3rd cumulant. May be missing if deg <= 1.

rho4

a numeric value giving the standardized 4th cumulant. May be missing if deg <= 2.

mu

a numeric value giving the mean.

May be missing if type = "standardized", since it is only needed for transformation purposes.

sigma2

a positive numeric value giving the variance.

May be missing if type= "standardized".

deg

an integer value giving the order of the approximation:

  • deg=1: corresponds to a normal approximation

  • deg=2: takes 3rd cumulant into account

  • deg=3: allows for the 4th cumulant as well. The default value is 3.

type

determines which sum should be approximated. Must be one of (“standardized”, “mean”, “sum”), representing the shifted and scaled sum, the weighted sum and the raw sum. Can be abbreviated.

Details

The Edgeworth approximation (EA) for the density of the standardized mean Z=(S_n-n*mu)/(n*sigma^2)^(1/2), where

  • S_n = Y_1 + … + Y_n denotes the sum of i.i.d. random variables,

  • mu denotes the expected value of Y_i,

  • sigma^2 denotes the variance of Y_i

is given by:

f_Z(s) = phi(z)*[1 + rho3/(6*n^(1/2))*H_3(z) +

rho4/(24*n)*H_4(z) + rho3^2/(72*n)*H_6(z)],

with phi denoting the density of the standard normal distribution and rho3 and rho4 denoting the 3rd and the 4th standardized cumulants of Y_i respectively. H_n(x) denotes the nth Hermite polynomial (see hermite for details).

The EA for the mean and the sum can be obtained by applying the transformation theorem for densities. In this case, the expected value mu and the variance sigma2 must be given to allow for an appropriate transformation.

Value

edgeworth returns an object of the class approximation. See approximation for further details.

Author(s)

Thorn Thaler

References

Reid, N. (1991). Approximations and Asymptotics. Statistical Theory and Modelling, London: Chapman and Hall.

See Also

approximation,hermite,saddlepoint

Examples

# Approximation of the mean of n iid Chi-squared(2) variables

n <- 10
df <- 2
mu <- df
sigma2 <- 2*df
rho3 <- sqrt(8/df)
rho4 <- 12/df
x <- seq(max(df-3*sqrt(2*df/n),0), df+3*sqrt(2*df/n), length=1000)
ea <- edgeworth(x, n, rho3, rho4, mu, sigma2, type="mean")
plot(ea, lwd=2)

# Mean of n Chi-squared(2) variables is n*Chi-squared(n*2) distributed
lines(x, n*dchisq(n*x, df=n*mu), col=2)

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(EQL)
Loading required package: ttutils
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/EQL/edgeworth.Rd_%03d_medium.png", width=480, height=480)
> ### Name: edgeworth
> ### Title: Edgeworth Approximation
> ### Aliases: edgeworth
> 
> ### ** Examples
> 
> # Approximation of the mean of n iid Chi-squared(2) variables
> 
> n <- 10
> df <- 2
> mu <- df
> sigma2 <- 2*df
> rho3 <- sqrt(8/df)
> rho4 <- 12/df
> x <- seq(max(df-3*sqrt(2*df/n),0), df+3*sqrt(2*df/n), length=1000)
> ea <- edgeworth(x, n, rho3, rho4, mu, sigma2, type="mean")
> plot(ea, lwd=2)
> 
> # Mean of n Chi-squared(2) variables is n*Chi-squared(n*2) distributed
> lines(x, n*dchisq(n*x, df=n*mu), col=2)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>