Finds the optimal Davies distribution for a dataset

Share:

Description

Finds the best-fit Davies distribution using either the least-squares criterion (least.squares()) or maximum likelihood (maximum.likelihood())

Usage

1
2
least.squares(data, do.print = FALSE, start.v = NULL)
maximum.likelihood(data, do.print = FALSE, start.v = NULL)

Arguments

data

dataset to be fitted

do.print

Boolean with TRUE meaning print a GFM

start.v

A suitable starting vector of parameters c(C,lambda1,lambda2), with default NULL meaning to use start()

Details

Uses optim() to find the best-fit Davies distribution to a set of data.

Value

Returns the parameters C,lambda1,lambda2 of the best-fit Davies distribution to the dataset data

Note

BUGS: can be screwed with bad value for start.v. Function maximum.likelihod() can be very slow. It might be possible to improve this by using some sort of hot-start for optim().

Author(s)

Robin K. S. Hankin

See Also

davies.start, optim, objective, likelihood

Examples

1
2
3
4
5
6
7
8
9
p <- c(10 , 0.1 , 0.1)
d <- rdavies(50,p)
system.time(print(maximum.likelihood(d)))
                           #observe how long this takes.
                           #The time is taken in repeated calls
                           #to pdavies(), which uses uniroot().

system.time(print(least.squares(d)))
                           #Much faster.