Encoding: UTF-8
Type: Package
Title: Asymmetry Measures for Probability Density Functions
Version: 0.2
Date: 2020-07-22
Maintainer: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>
Depends: R (≥ 3.5.0)
Imports: stats, sn, skewt, gamlss.dist
Description: Provides functions and examples for the weak and strong density asymmetry measures in the articles: "A measure of asymmetry", Patil, Patil and Bagkavos (2012) <doi:10.1007/s00362-011-0401-6> and "A measure of asymmetry based on a new necessary and sufficient condition for symmetry", Patil, Bagkavos and Wood (2014) <doi:10.1007/s13171-013-0034-z>. The measures provided here are useful for quantifying the asymmetry of the shape of a density of a random variable. The package facilitates implementation of the measures which are applicable in a variety of fields including e.g. probability theory, statistics and economics.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
NeedsCompilation: no
RoxygenNote: 6.1.0
LazyData: true
Packaged: 2020-07-22 04:45:06 UTC; Dimitris
Author: Dimitrios Bagkavos [aut, cre], Lucia Gamez [aut]
Repository: CRAN
Date/Publication: 2020-07-22 05:00:03 UTC

Epanechnikov kernel

Description

Implementation of the Epanechnikov kernel.

Usage

  Epanechnikov(x)

Arguments

x

A vector of data points between -\sqrt{5} and \sqrt{5} where the kernel will be evaluated.

Details

Implements:

K(u)= \frac{3}{4\sqrt{5}} \left (1-\frac{x^2}{5} \right )

for |x| \le \sqrt{5}

Value

The value of the kernel at x

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Kernel Statistics

See Also

IntEpanechnikov


annual Gross Domestic Product (GDP) per head across 15 European Union (EU) countries

Description

Contains values of the GDP/head distribution of 216 EU regions (the so called NUTS-2 level of the Eurostat categorization of territories within the EU for the year 1995.

Usage

  GDP.Per.head.dist.1995

Format

A vector with 184 values of the GDP/head distribution for 1995.

Source

Monfort, P. (2008). Convergence of EU regions measures and evolution. EU short papers on regional research and indicators, Directorate-General for Regional Policy 1/2008.

References

Monfort, P. (2008). Convergence of EU regions measures and evolution. EU short papers on regional research and indicators

See Also

GDP.Per.head.dist.2005


annual Gross Domestic Product (GDP) per head across 15 European Union (EU) countries

Description

Contains values of the GDP/head distribution of 216 EU regions (the so called NUTS-2 level of the Eurostat categorization of territories within the EU for the year 2005.

Usage

  GDP.Per.head.dist.1995

Format

A vector with 184 values of the GDP/head distribution for 2005.

Source

Monfort, P. (2008). Convergence of EU regions measures and evolution. EU short papers on regional research and indicators, Directorate-General for Regional Policy 1/2008.

References

Monfort, P. (2008). Convergence of EU regions measures and evolution. EU short papers on regional research and indicators

See Also

GDP.Per.head.dist.1995


Integrated Epanechnikov function

Description

Implements the Integrated Epanechnikov kernel.

Usage

  IntEpanechnikov(x)

Arguments

x

A vector of design points with values from -\sqrt{5} to \sqrt{5}.

Details

Implements:

K(u)= \int_{-\infty}^u \frac{3}{4\sqrt{5}} \left (1-\frac{x^2}{5} \right )\,dx

for |x| \le \sqrt{5}

Value

The value of the integrated kernel function at the user designated points.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Kernel Statistics

See Also

Epanechnikov


Integrated Kernel density estimator

Description

Classical univariate integrated kernel density estimator

Usage

  IntKde(xin, xout, h, kfun)

Arguments

xin

A vector of data points - the available sample size.

xout

grid points where the distribution function will be estimated.

h

The bandwidth parameter. Defaults to 3.572*\sigma*n^{-1/3} according to Bowman et al.(1998).

kfun

The kernel to use in the distribution function estimate.

Details

It implements the classical density integrated kernel estimator.

Let X_1,X_2,\dots, X_n be a univariate independent and identically distributed sample drawn from some unknown distribution function F. Its kernel density estimator is

\hat{F}(x)= n^{-1}\sum_{i=1}^n K\left \{ (x-X_i)h^{-1}\right \}

where K is an integrated kernel, and h > 0 is a smoothing parameter called the bandwidth.

Value

Returns a vector with the estimate of the distribution function at the user specified grid points.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>, Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Bowman, A., Hall, P., and Prvan, T., (1998), Bandwidth Selection for the Smoothing of Distribution Functions, Biometrika, 799-808.

See Also

bw.nrd, bw.nrd0, bw.ucv, bw.bcv

Examples

x.in <- rnorm(100)
x.out <- seq(-3.4,3.4,length=60)
kernel <- IntEpanechnikov
dist.est <- IntKde(xin=x.in,xout=x.out,kfun=kernel)
plot(x.out,dist.est, type="l", col="red", main="Kernel c.d.f. estimator")

Calculates \rho_p, used in the implementation of the strong asymmetry measure \eta(X).

Description

Estimates \rho_p, used in the calculation of the strong asymetry measure \eta(X).

Usage

  Rho.p(xin, p.param, dist, p1=0, p2=1)

Arguments

xin

A vector of data points - the available sample.

p.param

A parameter with the value greater than or equal to 1/2 and less than 1.

dist

Character string, specifies selected distribution function.

p1

A scalar. Parameter 1 (vector or object) of the selected distribution.

p2

A scalar. Parameter 2 (vector or object) of the selected distribution.

Details

Implements the quantity:

\frac{ 2\sqrt{3}}{p} \frac{-\int_{-\infty}^{\xi_p} f^2(x)F(x)\,dx - \frac{p}{2}\int_{-\infty}^{\xi_p} f^2(x)\,dx}{ \left \{ p\int_{-\infty}^{\xi_p} f^3(x)\,dx-(\int_{-\infty}^{\xi_p} f^2(x)\,dx)^2 \right \}^{1/2} }

defined on page 6 Patil, Bagkavos and Wood, see also (4) in Bagkavos, Patil and Wood . Estimation of the p.d.f. and c.d.f. functions is currently performed by maximum likelihood as e.g. kernel estimates inherit large amount of variance to \rho_p.

Value

Returns a scalar, the value of \rho_p.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

See Also

Rho.p.exact,Rhostar.p, Rhostar.p.exact

Examples

set.seed(1234)

selected.r <- "weib" #select Weibull as the distribution
shape <- 1 # specify shape parameter
scale <- 1  # specify scale parameter
n <- 100    # specify sample size
param <- 0.9 # specify parameter
xout<-r.sample(n,selected.r,shape,scale) # specify sample
Rho.p(xout,param,selected.r,shape,scale)  # calculate Rho.p
#-0.06665222  # returns the result

selected.r2 <- "norm" #select Normal as the distribution
n <- 100    # specify sample size
mean <- 0 # specify the mean
sd <- 1 # specify the variance
param <- 0.9 # specify parameter
xout <-r.sample(n,selected.r2,mean,sd) # specify sample
Rho.p(xout,param,selected.r2,mean,sd) # calculate Rho.p
#-0.1005591 # returns the result


selected.r3 <- "cauchy" #select Cauchy as the distribution
n <- 100    # specify sample size
location <- 0 # specify the location parameter
scale <- 1 # specify the scale parameter
param <- 0.9 # specify parameter
xout<-r.sample(n,selected.r3,location,scale) # specify sample
Rho.p(xout,param,selected.r3,location,scale) # calculate Rho.p
#-0.0580943  # returns the result

      

Calculates the exact value \rho_p, used in the implementation of the strong asymmetry measure \eta(X).

Description

Returns \rho_p, used in the calculation of the strong asymetry measure \eta(X).

Usage

  Rho.p.exact(xin, p.param, dist, p1=0, p2=1)

Arguments

xin

A vector of data points - the available sample.

p.param

A parameter with the value greater than or equal to 1/2 and less than 1.

dist

Character string, specifies selected distribution function.

p1

A scalar. Parameter 1 (vector or object) of the selected distribution.

p2

A scalar. Parameter 2 (vector or object) of the selected distribution.

Details

Implements the quantity:

\frac{ 2\sqrt{3}}{p} \frac{-\int_{-\infty}^{\xi_p} f^2(x)F(x)\,dx - \frac{p}{2}\int_{-\infty}^{\xi_p} f^2(x)\,dx}{ \left \{ p\int_{-\infty}^{\xi_p} f^3(x)\,dx-(\int_{-\infty}^{\xi_p} f^2(x)\,dx)^2 \right \}^{1/2} }

defined on page 6 Patil, Bagkavos and Wood, see also (4) in Bagkavos, Patil and Wood . This implementation uses exact calculation of the functionals in the definition of \rho_p.

Value

Returns a scalar, the exact value of \rho_p.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

See Also

Rho.p,Rhostar.p, Rhostar.p.exact

Examples

set.seed(1234)

selected.r <- "weib" #select Weibull as the distribution
shape <- 1 # specify shape parameter
scale <- 1  # specify scale parameter
n <- 100    # specify sample size
param <- 0.9 # specify parameter
xout<-r.sample(n,selected.r,shape,scale) # specify sample
Rho.p.exact(xout,param,selected.r,shape,scale)  # calculate Rho.p.exact
#-0.06665222  # returns the result

selected.r2 <- "norm" #select Normal as the distribution
n <- 100    # specify sample size
mean <- 0 # specify the mean
sd <- 1 # specify the variance
param <- 0.9 # specify parameter
xout <-r.sample(n,selected.r2,mean,sd) # specify sample
Rho.p.exact(xout,param,selected.r2,mean,sd) # calculate Rho.p.exact
#-0.2384271 # returns the result


selected.r3 <- "cauchy" #select Cauchy as the distribution
n <- 100    # specify sample size
location <- 0 # specify the location parameter
scale <- 1 # specify the scale parameter
param <- 0.9 # specify parameter
xout<-r.sample(n,selected.r3,location,scale) # specify sample
Rho.p.exact(xout,param,selected.r3,location,scale) # calculate Rho.p.exact
#-0.02340374  # returns the result


  

Calculates \rho_p^*, used in the implementation of the strong asymmetry measure \eta(X).

Description

Estimates \rho_p^*, used in the calculation of the strong asymetry measure \eta(X).

Usage

  Rhostar.p(xin, p.param, dist, p1, p2)

Arguments

xin

A vector of data points - the available sample.

p.param

A parameter with the value greater than or equal to 1/2 and less than 1.

dist

Character string, specifies selected distribution function.

p1

A scalar. Parameter 1 (vector or object) of the selected distribution.

p2

A scalar. Parameter 2 (vector or object) of the selected distribution.

Details

Implements the quantity

\frac{ 2\sqrt{3}}{p} \frac{-\int_{\xi_{1-p}}^{\infty}{f^2(x)(1-F(x))\,dx}+\frac{p}{2}\int_{\xi_{1-p}}^{\infty} f^2(x)\,dx}{ \left \{ p\int_{\xi_{1-p}}^{\infty}f^3(x)\,dx-(\int_{\xi_{1-p}}^{\infty}f^2(x)\,dx)^2 \right \}^{1/2} }

defined on page 6 Patil, Bagkavos and Wood (2014), see also (5) in Bagkavos, Patil and Wood (2016). Estimation of the p.d.f. and c.d.f. functions is currently performed by maximum likelihood as e.g. kernel estimates inherit large amount of variance to \rho_p^*.

Value

Returns a scalar, the value of \rho_p^*.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>, Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

See Also

Rho.p, Rhostar.p.exact, Rho.p.exact

Examples

set.seed(1234)

selected.r <- "weib" #select Weibull as the distribution
shape <- 1 # specify shape parameter
scale <- 1  # specify scale parameter
n <- 100    # specify sample size
param <- 0.9 # specify parameter
xout<-r.sample(n,selected.r,shape,scale) # specify sample
Rhostar.p(xout,param,selected.r,shape,scale)  # calculate Rhostar.p
#-0.08936363  # returns the result

selected.r2 <- "norm" #select Normal as the distribution
n <- 100    # specify sample size
mean <- 0 # specify the mean
sd <- 1 # specify the variance
param <- 0.9 # specify parameter
xout <-r.sample(n,selected.r2,mean,sd) # specify sample
Rhostar.p(xout,param,selected.r2,mean,sd) # calculate Rhostar.p
#-0.02302223 # returns the result


selected.r3 <- "cauchy" #select Cauchy as the distribution
n <- 100    # specify sample size
location <- 0 # specify the location parameter
scale <- 1 # specify the scale parameter
param <- 0.9 # specify parameter
xout<-r.sample(n,selected.r3,location,scale) # specify sample
Rhostar.p(xout,param,selected.r3,location,scale) # calculate Rhostar.p
#0.02043852  # returns the result

    

Calculates the exact value of \rho_p^*, used in the implementation of the strong asymmetry measure \eta(X).

Description

Returns \rho_p^*, used in the calculation of the strong asymetry measure \eta(X).

Usage

  Rhostar.p.exact(xin, p.param, dist, p1, p2)

Arguments

xin

A vector of data points - the available sample.

p.param

A parameter with the value greater than or equal to 1/2 and less than 1.

dist

Character string, specifies selected distribution function.

p1

A scalar. Parameter 1 (vector or object) of the selected distribution.

p2

A scalar. Parameter 2 (vector or object) of the selected distribution.

Details

Implements the quantity

\frac{ 2\sqrt{3}}{p} \frac{-\int_{\xi_{1-p}}^{\infty}{f^2(x)(1-F(x))\,dx}+\frac{p}{2}\int_{\xi_{1-p}}^{\infty} f^2(x)\,dx}{ \left \{ p\int_{\xi_{1-p}}^{\infty}f^3(x)\,dx-(\int_{\xi_{1-p}}^{\infty}f^2(x)\,dx)^2 \right \}^{1/2} }

defined on page 6 Patil, Bagkavos and Wood (2014), see also (5) in Bagkavos, Patil and Wood (2016). This implementation uses exact calculation of the functionals in the definition of \rho_p^*.

Value

Returns a scalar, the exact value of \rho_p^*.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

See Also

Rho.p, Rhostar.p, Rho.p.exact

Examples

set.seed(1234)

selected.r <- "weib" #select Weibull as the distribution
shape <- 1 # specify shape parameter
scale <- 1  # specify scale parameter
n <- 100    # specify sample size
param <- 0.9 # specify parameter
xout<-r.sample(n,selected.r,shape,scale) # specify sample
Rhostar.p.exact(xout,param,selected.r,shape,scale)  # calculate Rhostar.p.exact
#-0.05206678  # returns the result

selected.r2 <- "norm" #select Normal as the distribution
n <- 100    # specify sample size
mean <- 0 # specify the mean
sd <- 1 # specify the variance
param <- 0.9 # specify parameter
xout <-r.sample(n,selected.r2,mean,sd) # specify sample
Rhostar.p.exact(xout,param,selected.r2,mean,sd) # calculate Rhostar.p.exact
#-0.008687447 # returns the result


selected.r3 <- "cauchy" #select Cauchy as the distribution
n <- 100    # specify sample size
location <- 0 # specify the location parameter
scale <- 1 # specify the scale parameter
param <- 0.9 # specify parameter
xout<-r.sample(n,selected.r3,location,scale) # specify sample
Rhostar.p.exact(xout,param,selected.r3,location,scale) # calculate Rhostar.p.exact
#0.0280602  # returns the result
  

Simpson integration

Description

Implements simpson's extended integration rule.

Usage

  SimpsonInt(xin,h)

Arguments

xin

A vector of design points where the integral will be evaluated.

h

Assuming a<b and n is a positive integer. h = (b-a)/n.

Details

Simpson's extended numerical integration rule is implemented for n+1 equally spaced subdivisions (where n is even) of [a, b] as

\int_{a}^{b} f(x)\, dx = \frac{h}{3} \left \{ f(a) + 4f(x_1) + 2f(x_2) + 4f(x_3) + 2f(x_4) + ... + 4f(x_{n-1}) + f(b)\right \}

where hx=(b-a)/n and x_i=a+ihx. Simpson's rule will return an exact result when the polynomial in question has a degree of three or less. For other functions, Simpson's Rule only gives an approximation.

Value

A scalar, the approximate value of the integral.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Simpson's Rule

Examples

x.in<- seq(0,pi/4,length=5)
h.out <- pi/8
SimpsonInt(x.in,h.out)

Switch between a range of probability density functions.

Description

Returns the user-specified probability density function out of a range of available options evaluated at selected grid points.

Usage

d.sample(s,dist, p1,p2)

Arguments

s

A scalar or vector: the x-axis grid points where the probability density function will be evaluated.

dist

Character string, used as a switch to the user selected distribution function (see details below).

p1

A scalar. Parameter 1 (vector or object) of the selected density.

p2

A scalar. Parameter 2 (vector or object) of the selected density.

Details

Based on user-specified argument dist, the function returns the value of the probability density function at s.

Supported distributions (along with the corresponding dist values) are:

Value

A vector containing the user selected density values at the user specified points s.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>, Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Bagkavos D., Patil P.N., Wood A.T.A. (2016), A Numerical Study of the Power Function of a New Symmetry Test. In: Cao R., Gonzalez Manteiga W., Romo J. (eds), Nonparametric Statistics. Springer Proceedings in Mathematics and Statistics, vol 175, Springer.

See Also

r.sample, q.sample, p.sample

Examples

selected.dens <- "weib" #select Weibull as the density
shape <- 2  # specify shape parameter
scale <- 1 # specify scale parameter
xout <- seq(0.1,5,length=50)  #design point where the density is evaluated
d.sample(xout,selected.dens,shape,scale)  # calculate density at xout

Empirical cummulative distribution function

Description

Empirical (nonparametric) cummulative distribution function for given a random sample.

Usage

 edf(xin, xout) 

Arguments

xin

A vector of data points - the available sample.

xout

A vector of design points where the distribution function will be estimated.

Details

The empirical distribution function estimator at x is defined as the number of observations up to x, divided by n, i.e.

F_{n}(x) = \frac{\# \{ X_{1},..,X_{n}\} \le x}{n}

.

Value

A vector with the estimated distribution function at xout.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation:

Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Hollander, M. abd Wolfe, D.A. (1999), Nonparametric Statistical Methods, 2nd edition, Wiley.

Examples

x.in <- rexp(200)
x.out <- seq(0.1,5,length=60)
dist.est <- edf(x.in,x.out)
plot(x.out,dist.est,col="blue",main="Empirical c.d.f.",xlab="x",yla ="probability")

Strong asymmetry measure eta(X).

Description

Returns the strong asymmetry measure eta(X) of Patil, Bagkavos and Wood (2014).

Usage

 eta.s(xin, dist, GridLength, p1, p2)

Arguments

xin

A vector of data points - the available sample.

dist

Character string, specifies selected distribution function.

GridLength

A non-negative number, which will be rounded up if fractional.Desired length of the sequence.

p1

A scalar. Parameter 1 (vector or object) of the selected distribution.

p2

A scalar. Parameter 2 (vector or object) of the selected distribution.

Details

Implements

\eta(X)= -0.5 sign(\rho_1)\max|\rho_p + \rho_p^*|

with 1/2 \le p \le 1.

Uses maximum likehood estimates for the unknown functionals in the definition of the measure.

Value

Returns a scalar, the value of the strong asymmetry measure \eta(X).

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

See Also

eta.w.hat.bc, eta.w.hat, eta.w.breve,eta.w.breve.bc, eta.w.tilde,eta.w.tilde.bc

Examples


selected.dist <- "norm" #select norm as the distribution
m.use <- mean(GDP.Per.head.dist.2005)
sd.use<- sd(GDP.Per.head.dist.2005)
grid <- 50

s.use<- GDP.Per.head.dist.1995
eta.s(GDP.Per.head.dist.2005,selected.dist,grid,m.use,sd.use)
    

Strong asymmetry measure eta(X).

Description

Returns the strong asymmetry measure eta(X) of Patil, Bagkavos and Wood (2014).

Usage

  eta.s.exact(xin, dist, GridLength, p1, p2)

Arguments

xin

A vector of data points - the available sample.

dist

Character string, specifies selected distribution function.

GridLength

A non-negative number, which will be rounded up if fractional.Desired length of the sequence.

p1

A scalar. Parameter 1 (vector or object) of the selected distribution.

p2

A scalar. Parameter 2 (vector or object) of the selected distribution.

Details

Implements

\eta(X)= -0.5 sign(\rho_1)\max|\rho_p + \rho_p^*|

with 1/2 \le p \le 1 This version uses exact p.d.f. and c.d.f. evaluation and not estimates of the unknown functionals.

Value

Returns a scalar, the value of the strong asymmetry measure \eta(X).

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

See Also

eta.w.hat.bc, eta.w.hat, eta.w.breve,eta.w.breve.bc, eta.w.tilde,eta.w.tilde.bc,eta.s

Examples


selected.dist <- "norm" #select norm as the distribution
m.use <- 2
sd.use<- 2
grid <- 50
s.use<- rnorm(100)
eta.s.exact(s.use,selected.dist,grid,m.use,sd.use)  # calculate eta.s at xout


Asymmetry coefficient \breve{\eta}

Description

Implements the asymmetry coefficient \breve{\eta} of Patil, Patil and Bagkavos (2012).

Usage

  eta.w.breve(xin, kfun)

Arguments

xin

A vector of data points - the available sample.

kfun

The kernel to use in the density estimate.

Details

Given a sample X_1, X_2, \dots, X_n from a continuous density function f(x) and distribution function F(x), \breve{\eta} is defined by

\breve{\eta}=-\frac{\sum_{i=1}^n {U_iW_i}-n\bar{U}\bar{W}}{\sqrt{(\sum_{i=1}^n {U_i^2-n\bar{U^2}})(\sum_{i=1}^n{W_i^2-n\bar{W^2}})}}

where

U_i = \hat{f}(X_i), \; W_i =F_n(X_i), \; \bar{U}= n^{-1}\sum_{i=1}^n U_i, \; \bar{W}=n^{-1} \sum_{i=1}^{n} W_i.

Value

Returns a scalar, the estimate of \breve{\eta}.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>, Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Patil, P.N., Patil, P.P. and Bagkavos, D., (2012), A measure of asymmetry. Stat. Papers, 53, 971–985.

See Also

eta.w.hat.bc, eta.w.hat, eta.w.breve.bc, eta.w.tilde,eta.w.tilde.bc

Examples


eta.w.breve(GDP.Per.head.dist.1995,Epanechnikov)
0.329707 #estimate of etabreve

  

Asymmetry coefficient \breve{\eta} using boundary correction

Description

Implements the asymmetry coefficient \breve{\eta} of Patil, Patil and Bagkavos (2012).

Usage

  eta.w.breve.bc(xin, kfun)

Arguments

xin

A vector of data points - the available sample.

kfun

The kernel to use in the density estimate.

Details

Given a sample X_1, X_2,\dots, X_n from a continuous density function f(x) and distribution function F(x). \breve{\eta} is defined by

\breve{\eta}=-\frac{\sum_{i=1}^n {U_iW_i}-n\bar{U}\bar{W}}{\sqrt{(\sum_{i=1}^n {U_i^2-n\bar{U^2}})(\sum_{i=1}^n {W_i^2-n\bar{W^2}})}}

where

U_i = \hat{f}(X_i), \; W_i =F_n(X_i), \; \bar{U}=n^{-1}\sum_{i=1}^n U_i, \; \bar{W}=n^{-1}\sum_{i=1}^n W_i.

eta.w.breve.bc uses reflection to correct the boundary bias of the kernel density estimate kde

Value

Returns a scalar, the estimate of \breve{\eta}.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Patil, P.N., Patil, P.P. and Bagkavos, D., (2012), A measure of asymmetry. Stat. Papers, 53, 971-985.

See Also

eta.w.hat.bc, eta.w.hat, eta.w.breve, eta.w.tilde,eta.w.tilde.bc

Examples

eta.w.breve.bc(GDP.Per.head.dist.1995,Epanechnikov)
0.329707 #estimate of etabreve
  

Asymmetry coefficient \hat{\eta}

Description

Implements the asymmetry coefficient \hat{\eta} of Patil, Patil and Bagkavos (2012).

Usage

  eta.w.hat(xin, kfun)

Arguments

xin

A vector of data points - the available sample.

kfun

The kernel to use in the density estimate.

Details

Given a sample X_1, X_2,\dots, X_n from a continuous density function f(x) and distribution function F(x), \hat{\eta} is defined by

\hat{\eta}=-\frac{\sum_{i=1}^n {U_iV_i}-n\bar{U}\bar{V}}{\sqrt{(\sum_{i=1}^n{U_i^2-n\bar{U^2}})(\sum_{i=1}^n{V_i^2-n\bar{V^2}})}}

where

U_i = \hat{f}(X_i), \; V_i =\hat{F}(X_i), \; \bar{U}=n^{-1}\sum_{i=1}^n U_i, \; \bar{V}=n^{-1}\sum_{i=1}^n V_i.

Value

Returns a scalar, the estimate of \hat{\eta}.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>, Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Patil, P.N., Patil, P.P. and Bagkavos, D., (2012), A measure of asymmetry. Stat. Papers, 53, 971-985.

See Also

eta.w.hat.bc, eta.w.breve, eta.w.breve.bc, eta.w.tilde,eta.w.tilde.bc

Examples


eta.w.hat(GDP.Per.head.dist.1995,Epanechnikov)
0.3463025 #estimate of etahat

  

Asymmetry coefficient \hat{\eta} using boundary correction

Description

Implements the asymmetry coefficient \hat{\eta} of Patil, Patil and Bagkavos (2012)

Usage

  eta.w.hat.bc(xin, kfun)

Arguments

xin

A vector of data points - the available sample.

kfun

The kernel to use in the density estimate.

Details

Given a sample X_1, X_2, \dots, X_n from a continuous density function f(x) and distribution function F(x), \hat{\eta} is defined by

\hat{\eta}=-\frac{\sum_{i=1}^{n} {U_i V_i}-n\bar{U}\bar{V}}{\sqrt{(\sum_{i=1}^n{U_i^2-n\bar{U^2}})(\sum_{i=1}^n {V_i^2-n\bar{V^2}})}}

where

U_i = \hat{f}(X_i), \; V_i =\hat{F}(X_i), \; \bar{U}=n^{-1}\sum_{i=1}^n U_i, \; \bar{V}=n^{-1}\sum_{i=1}^n V_i.

eta.w.hat.bc uses reflection to correct the boundary bias issue of the kernel estimate kde.

Value

Returns a scalar, the estimate of \hat{\eta}.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>, Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Patil, P.N., Patil, P.P. and Bagkavos, D., (2012), A measure of asymmetry. Stat. Papers, 53, 971-985.

See Also

eta.w.hat, eta.w.breve, eta.w.breve.bc, eta.w.tilde,eta.w.tilde.bc

Examples

eta.w.hat.bc(GDP.Per.head.dist.1995,Epanechnikov)
0.3463025 #estimate of etahat.bc
  

Asymmetry coefficient \tilde{\eta}

Description

Implements the asymmetry coefficient \tilde{\eta} of Patil, Patil and Bagkavos (2012).

Usage

  eta.w.tilde(xin, kfun)

Arguments

xin

A vector of data points - the available sample.

kfun

The kernel to use in the density estimate.

Details

Given a sample X_1, X_2,\dots, X_n from a continuous density function f(x) and distribution function F(x). \tilde{\eta} is defined by

\tilde{\eta}=-\frac{\sum_{i=1}^n{U_iV_i}-(n/2)\bar{U}}{\sqrt{(n/12)(\sum_{i=1}^n{U_i^2-n\bar{U^2}})}}

where

U_i = \hat{f}(X_i), \; V_i =F(X_i), \; \bar{U}=n^{-1}\sum_{i=1}^n U_i, \; \bar{V}=n^{-1}\sum_{i=1} V_i.

Value

Returns a scalar, the estimate of \tilde{\eta}.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Patil, P.N., Patil, P.P. and Bagkavos, D., (2012), A measure of asymmetry. Stat. Papers, 53, 971-985.

See Also

eta.w.hat.bc, eta.w.hat, eta.w.breve.bc, eta.w.breve,eta.w.tilde.bc

Examples


eta.w.tilde(GDP.Per.head.dist.1995,Epanechnikov)
0.3333485 #estimate of etatile

  

Asymmetry coefficient \tilde{\eta} using boundary correction

Description

Implements the asymmetry coefficient \tilde{\eta} of Patil, Patil and Bagkavos (2012).

Usage

  eta.w.tilde.bc(xin, kfun)

Arguments

xin

A vector of data points - the available sample.

kfun

The kernel to use in the density estimate.

Details

Given a sample X_1, X_2,\dots, X_n from a continuous density function f(x) and distribution function F(x), \tilde{\eta} is defined by

\tilde{\eta}=-\frac{\sum_{i=1}^n{U_iV_i}-(n/2)\bar{U}}{\sqrt{(n/12)(\sum^{n}_{i=1}{U_i^2-n\bar{U^2}})}}

where

U_i = \hat{f}(X_i), \; V_i =F(X_i), \; \bar{U}=n^{-1}\sum_{i=1}^n U_i, \; \bar{V}=n^{-1}\sum_{i=1}^n V_i.

eta.w.tilde.bc uses reflection to correct the boundary bias of kde.

Value

Returns a scalar, the estimate of \tilde{\eta}.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Patil, P.N., Patil, P.P. and Bagkavos, D., (2012), A measure of asymmetry. Stat. Papers, 53, 971-985.

See Also

eta.w.hat.bc, eta.w.hat, eta.w.breve.bc, eta.w.breve,eta.w.tilde

Examples

eta.w.tilde.bc(GDP.Per.head.dist.1995,Epanechnikov)
0.3333485 #estimate of etatile.bc
  

Kernel density estimator.

Description

Classical univariate kernel density estimator.

Usage

  kde(xin, xout, h, kfun)

Arguments

xin

A vector of data points. Missing values not allowed.

xout

A vector of grid points at which the estimate will be calculated.

h

A scalar, the bandwidth to use in the estimate, e.g. bw.nrd(xin).

kfun

Kernel function to use.

Details

Implements the classical density kernel estimator based on a sample X_1,X_2,.., X_n of i.i.d observations from a distribution F with density h. The estimator is defined by

\hat{f}(x)= n^{-1}\sum_{i=1}^n K_h(x-X_{i})

where h is determined by a bandwidth selector such as Silverman's default plug-in rule and K, the kernel, is a non-negative probability density function.

Value

A vector with the density estimates at the designated points xout.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Silverman, B.W. (1986), Density Estimation for Statistics and Data Analysis, Chapman and Hall, London.

See Also

bw.nrd, bw.nrd0, bw.ucv, bw.bcv

Examples

x.in <- rnorm(100)
x.out <- seq(-3.4,3.4,length=60)
bandwidth <- bw.nrd(x.in)
kernel <- Epanechnikov
dens.est <- kde(x.in,x.out,bandwidth,kernel)
plot(x.out,dens.est,col="red",main="Kernel density estimator")

Switch between a range of available cumulative distribution functions.

Description

Returns the value of the selected cumulative distribution function at user supplied grid points.

Usage

p.sample(s,dist, p1,p2)

Arguments

s

A scalar or vector: the x-axis grid points where the cumulative distribution function is be evaluated.

dist

Character string, used as a switch to the user selected distribution function (see details below).

p1

A scalar. Parameter 1 (vector or object) of the selected distribution.

p2

A scalar. Parameter 2 (vector or object) of the selected distribution.

Details

Based on the user-specified argument dist, the function returns the value of the cumulative distribution function at s.

Supported distributions (along with the corresponding dist values) are:

Value

A vector containing the cumulative distribution function values at the user specified points s.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Bagkavos D., Patil P.N., Wood A.T.A. (2016), A Numerical Study of the Power Function of a New Symmetry Test. In: Cao R., Gonzalez Manteiga W., Romo J. (eds) Nonparametric Statistics. Springer Proceedings in Mathematics and Statistics, vol 175, Springer.

See Also

r.sample, q.sample, d.sample

Examples

selected.d <- "weib" #select Weibull as the CDF
shape <- 2  # specify shape parameter
scale <- 1 # specify scale parameter
xout <- seq(0.1,5,length=50)  #design point where the CDF is evaluated
p.sample(xout,selected.d,shape,scale)  # calculate CDF at xout

Calculate f^2(x)

Description

Calculates the square of a density.

Usage

pdfsq(s,dist, p1,p2)

Arguments

s

A scalar or vector: the x-axis grid points where the probability density function will be evaluated.

dist

Character string, used as a switch to the user selected distribution function (see details below).

p1

A scalar. Parameter 1 (vector or object) of the selected density.

p2

A scalar. Parameter 2 (vector or object) of the selected density.

Details

Based on user-specified argument dist, the function returns the value of f^2(x)dx, used in the definitions of \rho_p^*, \rho_p and their exact versions.

Supported distributions (along with the corresponding dist values) are:

Value

A vector containing the user selected density values at the user specified points s.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>, Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Bagkavos D., Patil P.N., Wood A.T.A. (2016), A Numerical Study of the Power Function of a New Symmetry Test. In: Cao R., Gonzalez Manteiga W., Romo J. (eds) Nonparametric Statistics. Springer Proceedings in Mathematics and Statistics, vol 175, Springer.

See Also

r.sample, q.sample, p.sample

Examples

  selected.dens <- "weib" #select Weibull
  shape <- 2  # specify shape parameter
  scale <- 1 # specify scale parameter
  xout <- seq(0.1,5,length=50)  #design point
  pdfsq(xout,selected.dens,shape,scale)  # calculate the square density at xout

Calculate f^2(x)F(x)

Description

Return the product f^2(x)F(x)

Usage

pdfsqcdf(s,dist, p1,p2)

Arguments

s

A scalar or vector: the x-axis grid points where the probability density function will be evaluated.

dist

Character string, used as a switch to the user selected distribution function (see details below).

p1

A scalar. Parameter 1 (vector or object) of the selected density.

p2

A scalar. Parameter 2 (vector or object) of the selected density.

Details

Based on user-specified argument dist, the function returns the value of f^2(x)F(x)dx, used in the definitions of \rho_p^*, \rho_p and their exact versions.

Supported distributions (along with the corresponding dist values) are:

Value

A vector containing the user selected density values at the user specified points s.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> ,Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Bagkavos D., Patil P.N., Wood A.T.A. (2016), A Numerical Study of the Power Function of a New Symmetry Test. In: Cao R., Gonzalez Manteiga W., Romo J. (eds) Nonparametric Statistics. Springer Proceedings in Mathematics and Statistics, vol 175, Springer.

See Also

r.sample, q.sample, p.sample

Examples

  selected.dens <- "weib" #select Weibull
  shape <- 2  # specify shape parameter
  scale <- 1 # specify scale parameter
  xout <- seq(0.1,5,length=50)  #design point
  pdfsqcdf(xout,selected.dens,shape,scale)  # calculate pdfsqcdf function at xout

Calculate f^2(x)(1-F(x)).

Description

Return the product f^2(x)(1-F(x)).

Usage

pdfsqcdfstar(s,dist, p1,p2)

Arguments

s

A scalar or vector: the x-axis grid points where the probability density function will be evaluated.

dist

Character string, used as a switch to the user selected distribution function (see details below).

p1

A scalar. Parameter 1 (vector or object) of the selected density.

p2

A scalar. Parameter 2 (vector or object) of the selected density.

Details

Based on user-specified argument dist, the function returns the value of f^2(x)(1-F(x))dx, used in the definitions of \rho_p^*, \rho_p and their exact versions.

Supported distributions (along with the corresponding dist values) are:

Value

A vector containing the user selected density values at the user specified points s.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>, Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Bagkavos D., Patil P.N., Wood A.T.A. (2016), A Numerical Study of the Power Function of a New Symmetry Test. In: Cao R., Gonzalez Manteiga W., Romo J. (eds) Nonparametric Statistics. Springer Proceedings in Mathematics and Statistics, vol 175, Springer.

See Also

r.sample, q.sample, p.sample

Examples

  selected.dens <- "weib" #select Weibull
  shape <- 2  # specify shape parameter
  scale <- 1 # specify scale parameter
  xout <- seq(0.1,5,length=50)  #design point
  pdfsqcdfstar(xout,selected.dens,shape,scale)  #return f^2(xout)F(xout)

Calculate f^3(x)

Description

Return the value of f^3(x).

Usage

pdfthird(s,dist, p1,p2)

Arguments

s

A scalar or vector: the x-axis grid points where the probability density function will be evaluated.

dist

Character string, used as a switch to the user selected distribution function (see details below).

p1

A scalar. Parameter 1 (vector or object) of the selected density.

p2

A scalar. Parameter 2 (vector or object) of the selected density.

Details

Based on user-specified argument dist, the function returns the value of f^3(x)dx, used in the definitions of \rho_p^*, \rho_p and their exact versions.

Supported distributions (along with the corresponding dist values) are:

Value

A vector containing the user selected density values at the user specified points s.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> ,Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Bagkavos D., Patil P.N., Wood A.T.A. (2016), A Numerical Study of the Power Function of a New Symmetry Test. In: Cao R., Gonzalez Manteiga W., Romo J. (eds) Nonparametric Statistics. Springer Proceedings in Mathematics and Statistics, vol 175, Springer.

See Also

pdfsq, pdfsqcdf, pdfsqcdfstar

Examples

  selected.dens <- "weib" #select Weibull
  shape <- 2  # specify shape parameter
  scale <- 1 # specify scale parameter
  xout <- seq(0.1,5,length=50)  #design point
  pdfthird(xout,selected.dens,shape,scale)  # calculate density to the cube at xout

Switch between a range of available quantile functions.

Description

Returns the quantiles of selected distributions at user specified locations.

Usage

q.sample(s,dist, p1=0,p2=1)

Arguments

s

A scalar or vector: the probabilities where the quantile function will be evaluated.

dist

Character string, used as a switch to the user selected distribution function (see details below).

p1

A scalar. Parameter 1 (vector or object) of the selected distribution.

p2

A scalar. Parameter 2 (vector or object) of the selected distribution.

Details

Based on user-specified argument dist, the function returns the value of the quantile function at s.

Supported distributions (along with the corresponding dist values) are:

Value

A vector containing the quantile values at the user specified points s.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Bagkavos D., Patil P.N., Wood A.T.A. (2016), A Numerical Study of the Power Function of a New Symmetry Test. In: Cao R., Gonzalez Manteiga W., Romo J. (eds) Nonparametric Statistics. Springer Proceedings in Mathematics and Statistics, vol 175, Springer.

See Also

r.sample, d.sample, p.sample

Examples

selected.q <- "norm" #select Normal as the distribution
shape <- 2  # specify shape parameter
scale <- 2 # specify scale parameter
xout <- seq(0.1,1,length=50)  #design point where the quantile function is evaluated
q.sample(xout,selected.q,shape,scale)  # calculate quantiles at xout
  

Switch between a range of available random number generators.

Description

Generate a random sample of size n out of a range of available distributions.

Usage

r.sample(s, dist, p1=0, p2=1)

Arguments

s

A scalar which specifies the size of the random sample drawn.

dist

Character string, used as a switch to the user selected distribution function (see details below).

p1

A scalar. Parameter 1 (vector or object) of the selected distribution.

p2

A scalar. Parameter 2 (vector or object) of the selected distribution.

Details

Based on user-specified argument dist, the function returns a random sample of size s from the corresponding distribution.

Supported distributions (along with the corresponding dist values) are:

Value

A vector of random values at the user specified points s.

Author(s)

Dimitrios Bagkavos and Lucia Gamez Gallardo

R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>

References

Bagkavos D., Patil P.N., Wood A.T.A. (2016), A Numerical Study of the Power Function of a New Symmetry Test. In: Cao R., Gonzalez Manteiga W., Romo J. (eds) Nonparametric Statistics. Springer Proceedings in Mathematics and Statistics, vol 175, Springer.

See Also

d.sample, q.sample, p.sample

Examples

selected.r <- "norm" #select Normal as the distribution
shape <- 2  # specify shape parameter
scale <- 1  # specify scale parameter
n <- 100    # specify sample size
r.sample(n,selected.r,shape,scale)  # calculate CDF at the designated point