Version: | 2.3.3 |
Date: | 2018-3-31 |
Title: | Generalize Lambda Distribution and Generalized Bootstrapping |
Author: | Bin Wang <bwang@southalabama.edu>. |
Maintainer: | Bin Wang <bwang@southalabama.edu> |
Depends: | R (≥ 2.5.0), boot, KernSmooth |
Description: | A collection of algorithms and functions for fitting data to a generalized lambda distribution via moment matching methods, and generalized bootstrapping. |
License: | Unlimited |
Packaged: | 2018-04-01 15:02:11 UTC; bwang |
Repository: | CRAN |
Date/Publication: | 2018-04-01 16:49:51 UTC |
NeedsCompilation: | yes |
Compute Average Run Length
Description
Compute average run length for control chart.
Usage
ARL1(x,K,pm1,pI1)
ARL0(x,ARL0=370,gridsize=20)
Arguments
x |
An R object generate using |
K |
a vector of the levels |
ARL0 |
in-control average run length |
pm1 , pI1 |
out-of-control parameters for the control chart. |
gridsize |
Gridsize of countour levels to search for ARL. |
Author(s)
B. Wang bwang@southalabama.edu
References
Yang, S.F. and Wang, B. “Using A Kernel Control Region to Monitor Both the Process Location and Dispersion”.
Basic functions for RS-GLD
Description
To compute the density, distribution, quantile, and to generate random sample for RS-GLD.
Usage
## Default S3 method:
degld(x,lambda)
pegld(x,lambda)
qegld(p,lambda)
regld(n,lambda)
Arguments
x |
a numeric value or a vector. |
p |
a probability or a vector of probabilities. |
n |
sample size. |
lambda |
a vector of four parameters for RS-GLD. |
Author(s)
B. Wang bwang@jaguar1.usouthal.edu
References
Karian, Z.A., Dudewicz, E.J., McDonald, P., 1996. The Extended Generalized Lambda Distribution System for Fitting Distributions to Data: history,completion of theory, tables, applications, the “final word” on moment fits, Comm. in Statist.- Simul. \& Comput. 25(3), 611-642.
Karian, Z.A., Dudewicz, E.J., 2000. Fitting Statistical Distributions: The Generalized Lambda Distribution and Generalized Bootstrap Methods, Chapman and Hall/CRC.
See Also
fit.egld
,
qrsgld
,prsgld
,
rrsgld
,drsgld
.
Examples
lambdas = c(2,4,3,4)
shape=3;scale=4
x0 = rbeta(5,shape,scale)
x1 = x0*lambdas[2]+lambdas[1]
qegld(c(0,.1,.5,.7,1),lambdas)
qbeta(c(0,.1,.5,.7,1),shape,scale)*lambdas[2]+lambdas[1]
pegld(x1,lambdas)
pbeta(x0,shape,scale)
degld(x1,lambdas)
dbeta(x0,shape,scale)/lambdas[2]
x0 = sort(rbeta(1000,shape,scale))
y = x0*lambdas[2]+lambdas[1]
plot(dbeta(x0,shape,scale)/lambdas[2]~y,type='l')
lines(degld(y,lambdas)~y,lty=2,col=2)
lines(density(y),col=4,lty=3)
Basic functions for RS-GLD
Description
To compute the density, distribution, quantile, and to generate random sample for RS-GLD.
Usage
## Default S3 method:
drsgld(x,lambda)
prsgld(x,lambda)
qrsgld(p,lambda)
rrsgld(n,lambda)
Arguments
x |
a numeric value or a vector. |
p |
a probability or a vector of probabilities. |
n |
sample size. |
lambda |
a vector of four parameters for RS-GLD. |
Author(s)
B. Wang bwang@jaguar1.usouthal.edu
References
Karian, Z.A., Dudewicz, E.J., McDonald, P., 1996. The Extended Generalized Lambda Distribution System for Fitting Distributions to Data: history,completion of theory, tables, applications, the “final word” on moment fits, Comm. in Statist.- Simul. \& Comput. 25(3), 611-642.
Karian, Z.A., Dudewicz, E.J., 2000. Fitting Statistical Distributions: The Generalized Lambda Distribution and Generalized Bootstrap Methods, Chapman and Hall/CRC.
See Also
fit.gld
,
qegld
,pegld
,
regld
,degld
.
Examples
lambdas = c(0, 0.1975, 0.1349,0.1349)
qrsgld(c(0,.1,.5,.7,1),lambdas)
prsgld(c(-10,0,1,3,20),lambdas)
drsgld(c(-10,0,1,3,20),lambdas)
x = sort(rrsgld(100,lambdas))
plot(dnorm(x)~x,type='l')
lines(drsgld(x,lambdas)~x,lty=2,col=2)
lines(density(x),col=4,lty=3)
Fit Extended Generalized Lambda Distribution (EGLD/GBD)
Description
To fit a EGLD or generalize beta distribution with the maximum likelihood methods.
Usage
fit.egld(x,xmin=NULL,xmax=NULL)
Arguments
x |
A sample. 'NA' values will be automatically removed. |
xmin |
The lower limit of the underlying distribution. Default: NULL. |
xmax |
The upper limit of the underlying distribution. Default: NULL. |
Author(s)
B. Wang bwang@jaguar1.usouthal.edu
References
Karian, Z.A., Dudewicz, E.J., McDonald, P., 1996. The Extended Generalized Lambda Distribution System for Fitting Distributions to Data: history,completion of theory, tables, applications, the “final word” on moment fits, Comm. in Statist.- Simul. \& Comput. 25(3), 611-642.
Karian, Z.A., Dudewicz, E.J., 2000. Fitting Statistical Distributions: The Generalized Lambda Distribution and Generalized Bootstrap Methods, Chapman and Hall/CRC.
See Also
fit.gld
,
qrsgld
,prsgld
,
rrsgld
,drsgld
.
Examples
b3=4;b4=4; b1=1;b2=5; # EGLD(b1,b2,b3,b4)
b1=0;b2=1; # equivalently beta(b3,b4)
b1=-3;b2=5;
xr = rbeta(100,b3,b4)
x = xr * b2 + b1
min(x); range(x)
sum(dbeta(xr,b3,b4,1))
x0 = seq(min(x),max(x),length=100)
x1 = (x0-b1)/b2
plot(dbeta(x1,b3,b4)/b2~x0,type='l',lwd=2,col=2)
lines(density(x),lty=2, col=2)
## no prior information on min and max
(out0 = fit.egld(x))
lines(out0,col=1)
## xmin known
(out1 = fit.egld(x,xmin=-3))
lines(out1,col=3,lwd=2)
## xmax known
(out2 = fit.egld(x,xmax=2))
lines(out2, col=4)
## both known
(out3 = fit.egld(x,xmin=-3,xmax=2))
lines(out3, col=5)
Fitting a Ramberg-Schmeiser-Tukey (RST) lambda distribution
Description
To fit a Ramberg-Schmeiser-Tukey (RST) lambda distribution with the three moment-matching methods.
Usage
fit.gld(x,method='LMoM')
Arguments
x |
A sample of size at least 6. 'NA' values will be automatically removed. |
method |
Choose GLD fitting method. Default: 'LMoM'. Other options: 'MoM'– method of moments; "MoP", method of percentiles; "LMoM", method of L-moments. 'best' chooses the best fit from the above three methods, which takes a while. |
Author(s)
B. Wang bwang@jaguar1.usouthal.edu
References
Karian, Z.A., Dudewicz, E.J., McDonald, P., 1996. The Extended Generalized Lambda Distribution System for Fitting Distributions to Data: history,completion of theory, tables, applications, the “final word” on moment fits, Comm. in Statist.- Simul. \& Comput. 25(3), 611-642.
Karian, Z.A., Dudewicz, E.J., 2000. Fitting Statistical Distributions: The Generalized Lambda Distribution and Generalized Bootstrap Methods, Chapman and Hall/CRC.
See Also
fit.egld
,
qrsgld
,prsgld
,
rrsgld
,drsgld
.
Examples
mu = 34.5; sig=1.5
y = rnorm(1000,mu,sig)
x = round(y) ### rounding errors
x0 = seq(min(y),max(y),length=100)
f0 = dnorm(x0,mu,sig)
plot(f0~x0,type='l')
lines(density(y),col=4)
## fit with method of moments
(out1 = fit.gld(x, method='MoM'))
lines(out1,col=2)
## Method of percentile
(out2 = fit.gld(x, method='mop'))
lines(out2, col=3)
## Method of L-moments
(out3 = fit.gld(x, method='lmom'))
lines(out3, col=5)
## Fitting EGLD
(out0 = fit.egld(x))
lines(out0,col=6)
legend(max(x0), max(f0), xjust=1,yjust=1,
legend=c("true","kde","MoM","MoP","LMoM","egld"),
lty=c(1,1,1,1,1,1),
col=c(1,4,2,3,5,6))
Estimate Asymptotic Joint Distribution of EWMA variables
Description
Estimate Asymptotic Joint Distribution of EWMA variables for control chart.
Usage
fkde(n=5, pm0=0.5, pI0=0.2, lambda=0.05,
gridsize=100,B=10000,T=10000)
Arguments
n |
sample size. |
lambda |
a parameter to compute EWMA |
pm0 , pI0 |
in-control parameters for the control chart. |
gridsize |
gridsize to evalue the joint PDF values |
B , T |
iteration times and maximum time of |
Author(s)
B. Wang bwang@southalabama.edu
References
Yang, S.F. and Wang, B. “Using A Kernel Control Region to Monitor Both the Process Location and Dispersion”.
Generalized bootstrapping
Description
Generalized bootstrapping
Usage
gboot(x,gldobj,statistic,...)
Arguments
x |
A random sample. |
gldobj |
Either an object fitting a GLD or EGLD to data 'x'. |
statistic |
User defined function to resample from 'x'. 'fun' could be parametric or non-parametric. |
... |
Controls |
References
Wang, B., Mishra, S.N., Mulekar, M., Mishra, N.S., Huang, K., (2010). Generalized Bootstrap Confidence Intervals for High Quantiles, In: Karian ZA, Dudewicz, EJ eds. The Handbook on Fitting Statistical Distributions with R. CRC Press. 2010: 877-913.
Wang, B., Mishra, S.N., Mulekar, M., Mishra, N.S., Huang, K., (2010). Comparison of bootstrap and generalized bootstrap methods for estimating high quantiles, Journal of Statistical Planning and Inferences, 140. 2926-2935. DOI: 10.1016/j.jspi.2010.03.016.
Karian, Z.A., Dudewicz, E.J., McDonald, P., 1996. The Extended Generalized Lambda Distribution System for Fitting Distributions to Data: history,completion of theory, tables, applications, the “final word” on moment fits, Comm. in Statist.- Simul. \& Comput. 25(3), 611-642.
Karian, Z.A., Dudewicz, E.J., 2000. Fitting Statistical Distributions: The Generalized Lambda Distribution and Generalized Bootstrap Methods, Chapman and Hall/CRC.
Dudewicz, E.J., 1992. The Generalized Bootstrap, Bootstrapping and Related Techniques, In: K.H., G. Rothe, W. Sendler, eds., V. 376 of Lecture Notes in Economics and Mathematical Systems, Springer-Verlag, Berlin, 31-37.
Examples
data(ofc)
X = ofc$x0
Ta = function(x) mean(x<31)
gld0 = fit.gld(X)
(out = gboot(X,gld0,statistic=Ta,R=100))
gld1 = fit.egld(X)
(out = gboot(X,gld1,statistic=Ta,R=100))
OFC data
Description
Simulated head size data of new borns.
Usage
data(ofc)
Format
A data frame with 1000 observations on 2 variables.
x0 | numeric | Original OFC values |
x | numeric | OFC values rounded to centimeters |
References
Wang, CSDA and JSS papers.