JonasMoss / kdensity

An R package for kernel density estimation with parametric starts and asymmetric kernels.
Other
14 stars 4 forks source link

Add good error messages when the ML does not exist. #44

Closed JonasMoss closed 5 years ago

JonasMoss commented 6 years ago

Here's an example of the problem:

x = c(0, rgamma(100, 10, 1))
> kdensity::kdensity(x, start = "gamma")
Error in if (abs((shape - shape0)/shape0) < rel.tol) break : 
  missing value where TRUE/FALSE needed

Here's what I propse we do:

  1. Find all the sinners (is e.g. beta a sinner as well?)
  2. decide on a uniform error message,
  3. perhaps make a suggestion for how to avoid the problem: Using a jitter function for instance.
JonasMoss commented 5 years ago

Fixed this by added "assertthat"s to each sinner. The messages should be clear enough.