[R] fitting a distribution to a ecdf plot

Frank Harrell f.harrell at vanderbilt.edu
Tue Mar 15 23:27:48 CET 2011


If you try more than one or two distributions the final estimates, while
appearing to have higher precision that the ECDF, will actually have the
same precision.  That is because of model uncertainty.  This would be
revealed by bootstrapping.  There is little advantage to using a parametric
model if nonparametric estimates are used as touchstones.

Frank


Lathouri, Maria wrote:
> 
> Hallo
> yes I tried it as well and it works;
> 
> Thank you a lot
> 
> Maria
> 
> ________________________________
> From: Dennis Murphy [djmuser at gmail.com]
> Sent: 15 March 2011 21:36
> To: Lathouri, Maria
> Cc: r-help at r-project.org
> Subject: Re: [R] fitting a distribution to a ecdf plot
> 
> Hi:
> 
> The fitdistrplus package from CRAN may be useful. I tried it on your data
> and the lognormal seemed to fit well, apart from the outlier. I just
> followed the vignette that accompanies the package.
> 
> library(fitdistplus)
> 
> plotdist(NOEccu)                             # ecdf
> descdist(NOEccu, boot = 1000)      # Cullen-Frey graph based on 1000
> bootstrap samples
> 
> # The Cullen-Frey graph suggests that the distribution is somewhere
> between a Gamma and lognormal
> 
> # Weibull
> N1w <- fitdist(NOEccu, 'weibull')
> # Warning messages:
> # 1: In dweibull(x, shape, scale, log) : NaNs produced
> # 2: In dweibull(x, shape, scale, log) : NaNs produced
> plot(N1w)
> summary(N1w)
> 
> # Gamma
> N1g <- fitdist(NOEccu, 'gamma')
> # Warning messages:
> # 1: In dgamma(x, shape, scale, log) : NaNs produced
> # 2: In dgamma(x, shape, scale, log) : NaNs produced
> # 3: In dgamma(x, shape, scale, log) : NaNs produced
> # 4: In dgamma(x, shape, scale, log) : NaNs produced
> plot(N1g)
> summary(N1g)
> 
> # Lognormal
> N1l <- fitdist(NOEccu, 'lnorm')
> plot(N1l)
> summary(N1l)
> 
> Try it out and see if it suits your needs.
> 
> HTH,
> Dennis
> 
> On Tue, Mar 15, 2011 at 9:00 AM, Lathouri, Maria
> <m.lathouri06 at imperial.ac.uk<mailto:m.lathouri06 at imperial.ac.uk>>
> wrote:
> Dear all,
> 
> I need to plot an cumulative distribution plot of a variable and then to
> fit a distribution to that, probably a weibull or lognormal.
> 
> I have plotted the ecdf as
>> plot(ecdf(x))
> 
> but I haven't managed to fit the distribution. I have as well attached the
> data.
> 
> I would appreciate if you could help me on that.
> 
> Thank you.
> 
> Kind regards
> Maria
> 
> ______________________________________________
> R-help at r-project.org<mailto:R-help at r-project.org> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


-----
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context: http://r.789695.n4.nabble.com/fitting-a-distribution-to-a-ecdf-plot-tp3357015p3357954.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list