| least.squares {Davies} | R Documentation |
Finds the best-fit Davies distribution using either the least-squares
criterion (least.squares()) or maximum likelihood
(maximum.likelihood())
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 TRUE meaning print a GFM |
start.v |
A suitable starting vector of parameters
c(C,lambda1,lambda2). If NULL, use start() |
Uses optim() to find the best-fit Davies distribution to a set
of data.
Returns the parameters C,lambda1,lambda2 of
the best-fit Davies distribution to the dataset data
BUGS: can be screwed with bad value for start.v.
maximum.likelihod() is very slow. It might be possible to
improve this by using some sort of hot-start for optim().
Robin K. S. Hankin
davies.start, optim,
objective, likelihood
p <- c(10 , 0.1 , 0.1)
data <-rdavies(50,p)
system.time(print(maximum.likelihood(data)))
#observe how long this takes.
#The time is taken in repeated calls
#to pdavies(), which uses uniroot().
system.time(print(least.squares(data)))
#Much faster.