fun.auto.bimodal.qs {GLDEX} | R Documentation |
Fitting mixtures of generalied lambda distribtions to data using quantile matching method
Description
This function will fit mixture of generalised lambda distributions to dataset. It is restricted to two generalised lambda distributions. The method of fitting is quantile matching method. It is a two step optimization procedure, each unimodal part of the bimodal distribution is modelled using quantile matching method. The initial values obtained are then used to maximise the theoretical and empirical quantile match for the entire bimodal distribution. It fits mixture of the form p*(f1)+(1-p)*(f2) where f1 and f2 are pdfs of the generalised lambda distributions.
Usage
fun.auto.bimodal.qs(data, per.of.mix = 0.01, clustering.m = clara,
init1.sel = "rprs", init2.sel = "rprs", init1=c(-1.5, 1.5), init2=c(-1.5, 1.5),
leap1=3, leap2=3, fun1 = "runif.sobol", fun2 = "runif.sobol", trial.n = 100,
len = 1000, type = 7, no = 10000, maxit = 5000)
Arguments
data |
A numerical vector representing the dataset. |
per.of.mix |
Level of mix between two parts of the distribution, usually 1-2% of cross mix is sufficient. |
clustering.m |
Clustering method used in classifying the dataset into two parts. Valid arguments include clara, fanny and pam from the cluster library. Default is clara. Or a logical vector specifying how data should be split. |
init1.sel |
This can be |
init2.sel |
This can be |
init1 |
Inititial values lambda3 and lambda4 for the first generalised lambda distribution. |
init2 |
Inititial values lambda3 and lambda4 for the second generalised lambda distribution. |
leap1 |
See scrambling argument in |
fun1 |
A character string of either |
leap2 |
See scrambling argument in |
fun2 |
A character string of either |
trial.n |
Number of evenly spaced quantile ranging from 0 to 1 to be
used in the checking phase, to find the best set of initial values for
optimisation, this is intended to be lower than |
len |
Number of evenly spaced quantile ranging from 0 to 1 to be used, default is 1000 |
type |
Type of quantile to be used, default is 7, see |
no |
Number of initial random values to find the best initial values for optimisation. |
maxit |
Maximum number of iterations for numerical optimisation. Default is 5000. |
Details
The initial values that work well for RPRS are c(-1.5,1.5)
and for RMFMKL
are c(-0.25,1.5)
. For scrambling, if 1
, 2
or 3
the
sequence is scrambled otherwise not. If 1
, Owen type type of scrambling
is applied, if 2
, Faure-Tezuka type of scrambling, is applied, and if
3
, both Owen+Faure-Tezuka type of scrambling is applied. The star
method uses the same initial values as rmfmkl
since it uses the FMKL
generalised lambda distribution. Nelder-Simplex algorithm is used in the
numerical optimization. rprs
stands for revised percentile method for
RS generalised lambda distribution and "rmfmkl" stands for revised method of
moment for FMKL generalised lambda distribution. These acronyms represents the
initial optimization algorithm used to get a reasonable set of initial values
for the subsequent optimization procedues.
Value
par |
The best set of parameters found, the first four corresponds to the first distribution fit, the second four corresponds to the second distribution fit, the last value correspond to p for the first distribution fit. |
value |
The value of -ML for the paramters obtained. |
counts |
A two-element integer vector giving the number of calls to
|
convergence |
|
message |
A character string giving any additional information returned by
the optimizer, or |
Note
If the number of observations is small,
rprs
can sometimes fail as the percentiles may not exist for this data.
Also, if the initial values do not span a valid generalised lambda distribution,
try another set of initial values.
Author(s)
Steve Su
References
Bratley P. and Fox B.L. (1988) Algorithm 659: Implementing Sobol's quasi random sequence generator, ACM Transactions on Mathematical Software 14, 88-100.
Joe S. and Kuo F.Y. (1998) Remark on Algorithm 659: Implementing Sobol's quasi random Sequence Generator.
Nelder, J. A. and Mead, R. (1965) A simplex algorithm for function minimization. Computer Journal *7*, 308-313.
Su (2008). Fitting GLD to data via quantile matching method. (Book chapter to appear)
See Also
fun.auto.bimodal.pml
, fun.auto.bimodal.ml
,
fun.plot.fit.bm
,
fun.diag.ks.g.bimodal
Examples
# Fitting faithful data from the dataset library, with the clara clustering
# regime. The first distribution is RS and the second distribution is fmkl.
# The percentage of data mix is 1%.
fun.auto.bimodal.qs(faithful[,1],per.of.mix=0.01,clustering.m=clara,
init1.sel="rprs",init2.sel="rmfmkl",init1=c(-1.5,1,5),init2=c(-0.25,1.5),
leap1=3,leap2=3)