Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fun.bimodal.fit.ml

Finds the final fits using the maximum likelihood estimation for the bimodal dataset.


Description

This is the secondary optimization procedure to evaluate the final bimodal distribution fits using the maximum likelihood. It usually relies on initial values found by fun.bimodal.init function.

Usage

fun.bimodal.fit.ml(data, first.fit, second.fit, prop, param1, param2, selc1, 
selc2)

Arguments

data

Dataset to be fitted.

first.fit

The distribution parameters or the initial values of the first distribution fit.

second.fit

The distribution parameters or the initial values of the second distribution fit.

prop

The proportion of the data set, usually obtained from fun.bimodal.init.

param1

Can be either "rs" or "fmkl", depending on the type of first distribution used.

param2

Can be either "rs" or "fmkl", depending on the type of second distribution used.

selc1

Selection of initial values for the first distribution, can be either "rs", "fmkl" or "star". Choose initial values from RPRS (ML), RMFMKL (ML) or STAR method.

selc2

Selection of initial values for the second distribution, can be either "rs", "fmkl" or "star". Choose initial values from RPRS (ML), RMFMKL (ML) or STAR method.

Details

This function should be used in tandem with fun.bimodal.init.

Value

par

The first four numbers are the parameters of the first generalised lambda distribution, the second four numbers are the parameters of the second generalised lambda distribution and the last value is the proportion of the first generalised lambda distribution.

value

The objective value of negative likelihood obtained using the par above.

counts

A two-element integer vector giving the number of calls to functions. Gradient is not used in this case.

convergence

An integer code. 0 indicates successful convergence. Error codes are:

1 indicates that the iteration limit 'maxit' had been reached.

10 indicates degeneracy of the Nelder-Mead simplex.

message

A character string giving any additional information returned by the optimizer, or NULL.

Note

There is currently no guarantee of a global convergence.

Author(s)

Steve Su

References

Su (2007). Fitting Single and Mixture of Generalized Lambda Distributions to Data via Discretized and Maximum Likelihood Methods: GLDEX in R. Journal of Statistical Software: *21* 9.

See Also

link{fun.bimodal.fit.pml}, fun.bimodal.init

Examples

## Extract faithful[,2] into faithful2
# faithful2<-faithful[,2]

## Uses clara clustering method
# clara.faithful2<-fun.class.regime.bi(faithful2, 0.01, clara)

## Save into two different objects
# qqqq1.faithful2.cc<-clara.faithful2$data.a
# qqqq2.faithful2.cc<-clara.faithful2$data.b

## Find the initial values
# result.faithful2.init<-fun.bimodal.init(data1=qqqq1.faithful2.cc,
# data2=qqqq2.faithful2.cc, rs.leap1=3,fmkl.leap1=3,rs.init1 = c(-1.5, 1.5), 
# fmkl.init1 = c(-0.25, 1.5), rs.leap2=3,fmkl.leap2=3,rs.init2 = c(-1.5, 1.5), 
# fmkl.init2 = c(-0.25, 1.5))

## Find the final fits
# result.faithful2.rsrs<-fun.bimodal.fit.ml(data=faithful2,
# result.faithful2.init[[2]],result.faithful2.init[[3]],
# result.faithful2.init[[1]], param1="rs",param2="rs",selc1="rs",selc2="rs")

## Output
# result.faithful2.rsrs

GLDEX

Fitting Single and Mixture of Generalised Lambda Distributions (RS and FMKL) using Various Methods

v2.0.0.7
GPL (>= 3)
Authors
Steve Su, with contributions from: Diethelm Wuertz, Martin Maechler and Rmetrics core team members for low discrepancy algorithm, Juha Karvanen for L moments codes, Robert King for gld C codes and starship codes, Benjamin Dean for corrections and input in ks.gof code and R core team for histsu function.
Initial release
2020-02-04

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.