[R] Johnson Distribution Fit
David Winsemius
dwinsemius at comcast.net
Mon Oct 4 00:33:13 CEST 2010
On Oct 3, 2010, at 3:47 PM, Abey George wrote:
> Hi,
> I am trying to fit a Johnson SB distribution using fitdist
> function in
> fitdistrplus Library. I have defined the Johnson SB distribution
> from (
> http://www.ntrand.com/johnson-sb-distribution/) . But it gives me the
> follwing errors. Any help would be appreciated
Are you really trying to estimate the bounding values as well as the
gamma and delta parameters. Those would seem to be more likely
determined by the nature of the problem, e.g., policy limits on the
insured sums if this were a financial problem.
>
> #xi = xi
> #lambda =l
> #delta =d
> #gamma = g
>
> djohn = function(x,xi,l,d,g)
> (d/(l*sqrt(2*pi)*((x-xi)/l)*(1-((x-xi)/l))))*exp[-0.5*(g +
> d*log(((x-xi)/l)/(1-((x-xi)/l))))^2]
You used exp[ ] where you probably wanted exp().
>
> pjohn = function(x,xi,l,d,g) pnorm(g + d*log(((x-xi)/l)/(1-((x-xi)/
> l))))
>
> qjohn = function(p,xi,l,d,g) xi + (l*exp((qnorm(p) - g)/d))/(1 +
> exp((qnorm(p) - g)/d))
>
> f1c <- fitdist(data2,"john",start=list(xi = 0.5 ,l = 50, d = 1, g =
> 1))
You have not given us the "data2" variables, so we have no way of
checking whether any of them appear outside the range [epsilon, lambda
+epsilon]. Using your data2 vector, what are the results of :
any(data2 < 0.5 | data2 > 0.5+50) #?
>
> Error in fitdist(data2, "john", start = list(xi = 0.5, l = 50, d =
> 1, :
> the function mle failed to estimate the parameters,
> with the error code 100
> In addition: Warning message:
> In log(((x)/l)/(1 - ((x)/l))) : NaNs produced
>
>
> Cheers
> AG
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list