diff --git a/DESCRIPTION b/DESCRIPTION index bc275cf..310f3ed 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: fitdistrplus Title: Help to Fit of a Parametric Distribution to Non-Censored or Censored Data -Version: 1.2-1 +Version: 1.2-2 Authors@R: c(person("Marie-Laure", "Delignette-Muller", role = "aut", email = "marielaure.delignettemuller@vetagro-sup.fr", comment = c(ORCID = "0000-0001-5453-3994")), person("Christophe", "Dutang", role = "aut", email = "christophe.dutang@ensimag.fr", comment = c(ORCID = "0000-0001-6732-1501")), person("Regis", "Pouillot", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index c01ab7a..cc7654c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# fitdistrplus 1.2-2 + +BUG FIX + +- the default starting value for the gamma distribution was wrongly computed for the rate parameter. + # fitdistrplus 1.2-1 NEW FEATURES diff --git a/R/util-startarg.R b/R/util-startarg.R index f9048db..2cc9875 100644 --- a/R/util-startarg.R +++ b/R/util-startarg.R @@ -481,7 +481,7 @@ startarg_transgamma_family <- function(x, distr) if(v > 0) { alphahat <- m^2/v - thetahat <- m/v + thetahat <- v/m }else #exponential case { alphahat <- 1 diff --git a/tests/t-startingvalues-trgamma-family.R b/tests/t-startingvalues-trgamma-family.R index c35d1f9..e13dc02 100644 --- a/tests/t-startingvalues-trgamma-family.R +++ b/tests/t-startingvalues-trgamma-family.R @@ -20,6 +20,12 @@ fitdist(x, "weibull") fitdist(x, "exp") +x <- rgamma(n, 2, 2) + +fitdistrplus:::startarg_transgamma_family(x, "gamma") + + + #weird examples x <- rep(1, n) diff --git a/vignettes/starting-values.Rmd b/vignettes/starting-values.Rmd index e2fc786..3b8af35 100644 --- a/vignettes/starting-values.Rmd +++ b/vignettes/starting-values.Rmd @@ -752,7 +752,7 @@ n/\tau + \alpha\sum_i \log(x_i/\theta) +\sum_i \tau \frac{x_i}{\theta^2}(x_i/\theta)^{\tau-1} \end{pmatrix}. $$ -We compute moment-estimator as in gamma +We compute the moment-estimator as in gamma \eqref{eq:gamma:relation} $$ \hat\alpha = m_2^2/\mu_2, \hat\theta= \mu_2/m_1. @@ -766,11 +766,12 @@ $$ Transformed gamma with $\tau=1$ -We compute moment-estimator as in gamma -$$ +We compute the moment-estimator given by +\begin{equation} \hat\alpha = m_2^2/\mu_2, \hat\theta= \mu_2/m_1. -$$ +\label{eq:gamma:relation} +\end{equation} ### Weibull distribution