Finds the optimal Davies distribution for a dataset
Description
Finds the bestfit Davies distribution using either the leastsquares
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 
start.v 
A suitable starting vector of parameters

Details
Uses optim()
to find the bestfit Davies distribution to a set
of data.
Value
Returns the parameters C,lambda1,lambda2 of
the bestfit 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 hotstart
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.
