Finds the bestfit Davies distribution using either the leastsquares
criterion (least.squares()
) or maximum likelihood
(maximum.likelihood()
)
1 2  least.squares(data, do.print = FALSE, start.v = NULL)
maximum.likelihood(data, do.print = FALSE, start.v = NULL)

data 
dataset to be fitted 
do.print 
Boolean with 
start.v 
A suitable starting vector of parameters

Uses optim()
to find the bestfit Davies distribution to a set
of data.
Returns the parameters C,lambda1,lambda2 of
the bestfit Davies distribution to the dataset data
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 hotstart
for optim()
.
Robin K. S. Hankin
davies.start
, optim
,
objective
, likelihood
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.

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.