Gives a “start” value for the optimization routines. Uses heuristics that seem to work.

1 | ```
davies.start(x, threeps=c(0.1,0.5,0.9), small = 0.01)
``` |

`x` |
dataset to be used |

`threeps` |
a three-element vector representing the quantiles to be balanced. The default values balance the first and ninth deciles and the median. These seem to work for me pretty well; YMMV |

`small` |
a “small” value to be used for |

Returns a “start” value of the pararameters for use in one of the
Davies fitting routines `maximum.likelihood()`

or `least.squares()`

.

Uses three heuristic methods (one assuming *lambda1=lambda2*, one with *lambda1=0*,
and one with *lambda2=0*). Returns the best one of the
three, as measured by `objective()`

.

Robin K. S. Hankin

`least.squares`

, `maximum.likelihood`

,
`objective`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
d <- rchisq(40,1)
davies.start(d)
least.squares(d)
params <- c(10 , 0.1 , -0.1)
x <- rdavies(100 , params)
davies.start(x)
f <- function(threeps){objective(davies.start(x,threeps),x)}
(jj<-optim(c(0.1,0.5,0.9),f))
davies.start(x,jj$par)
least.squares(x)
#not bad at all.
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.