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.)
Value
'dnormpoly' gives the density, 'pnormpoly' gives the cumulative distribution
function, 'qnormpoly' gives the quantile function, and 'rnormpoly'
generates random deviates.
data2normpoly4 for the parameter estimation and
dcauchypoly for the Cauchy-polynomial quantile mixture.
Examples
#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');
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(Lmoments)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Lmoments/normpoly.Rd_%03d_medium.png", width=480, height=480)
> ### Name: normpoly
> ### Title: Normal-polynomial quantile mixture
> ### Aliases: qnormpoly pnormpoly dnormpoly rnormpoly normpoly_inv
> ### normpoly_cdf normpoly_pdf normpoly_rnd
> ### Keywords: distribution robust
>
> ### ** Examples
>
> #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');
>
>
>
>
>
> dev.off()
null device
1
>