Learn R Programming

Lmoments (version 1.3-1)

normpoly: Normal-polynomial quantile mixture

Description

Density, distribution function, quantile function and random generation for the normal-polynomial quantile mixture.

Usage

dnormpoly(x,param)
pnormpoly(x,param)
qnormpoly(cp,param)
rnormpoly(n,param)
normpoly_pdf(x,param)
normpoly_cdf(x,param)
normpoly_inv(cp,param)
normpoly_rnd(n,param)

Value

'dnormpoly' gives the density, 'pnormpoly' gives the cumulative distribution function, 'qnormpoly' gives the quantile function, and 'rnormpoly' generates random deviates.

Arguments

x

vector of quantiles

cp

vector of probabilities

n

number of observations

param

vector of parameters

Author

Juha Karvanen juha.karvanen@iki.fi

Details

The length the parameter vector specifies the order of the polynomial in the quantile mixture. If k<-length(param) then param[1:(k-1)] contains the mixture coefficients of polynomials starting from the constant and param[k] is the mixture coefficient for normal distribution. (Functions normpoly\_pdf, normpoly\_cdf, normpoly\_inv and normpoly\_rnd are aliases for compatibility with older versions of this package.)

References

Karvanen, J. 2006. Estimation of quantile mixtures via L-moments and trimmed L-moments, Computational Statistics & Data Analysis 51, (2), 947--959. http://www.bsp.brain.riken.jp/publications/2006/karvanen_quantile_mixtures.pdf.

See Also

data2normpoly4 for the parameter estimation and dcauchypoly for the Cauchy-polynomial quantile mixture.

Examples

Run this code
#Generates a sample 500 observations from the normal-polynomial quantile mixture, 
#calculates L-moments and their covariance matrix,
#estimates parameters via L-moments and 
#plots the true pdf and the estimated pdf together with the histogram of the data.
true_params<-lmom2normpoly4(c(0,1,0.2,0.05));
x<-rnormpoly(500,true_params);
lmoments<-Lmoments(x);
lmomcov<-Lmomcov(x);
estim_params<-lmom2normpoly4(lmoments);
hist(x,30,freq=FALSE)
plotpoints<-seq(min(x)-1,max(x)+1,by=0.01);
lines(plotpoints,dnormpoly(plotpoints,estim_params),col='red');
lines(plotpoints,dnormpoly(plotpoints,true_params),col='blue');

Run the code above in your browser using DataLab