[R] 'fitdistr' and two views of the same data?

apjaworski@mmm.com apjaworski at mmm.com
Wed May 18 17:39:06 CEST 2005


There is nothing wrong here.  I rerun your example and got the same
parameters.  Your only "problem" is that you let the density plot use the
default limits on x, which are not reasonable here since your data extends
to over 200.  Try this:

hist(dd, freq=FALSE)  #dd is your original data
xx <- seq(0, 300, by=.1)
yy <- dweibull(xx, shape=1.5079, scale=60.2139)
lines(xx, yy, col=2)

BTW, when you binned your data you also scaled it down by 20, so your scale
parameter changed accordingly.



Andy Jaworski
Process Laboratory
3M Corporate Research Laboratory
E-mail: apjaworski at mmm.com
Tel:  (651) 733-6092
Fax:  (651) 736-3122

             Matt Jadud                                                    
             <jadudm at gmail.com                                             
             >                                                          To 
             Sent by:                  R-help at stat.math.ethz.ch            
             r-help-bounces at st                                          cc 
                                       [R] 'fitdistr' and two views of the 
             05/18/2005 09:34          same data?                          
             Please respond to                                             
                Matt Jadud                                                 
             <jadudm at gmail.com                                             


I have detailed (with pictures and whatnot) my question on my weblog at


The short version of the question is this:

When I ask 'fitdistr' to try and fit my distribution as a "weibull"
distribution, it comes up with some rather wacky parameters.

If I take the same distribution, and do something like

newdist <- mapply(function(x) ((x %/% 20) + 1), origdist)

which effectively forces the data into a histogram, 'fitdist' on
'newdist' gives me an entirely different set of parameters.
Distressingly, the parameters it gives me are, upon inspection, good;
that is, the parameters reported fit the distribution of the original
data much better than 'fitdist' of 'origdist'.

Unfortunately, I'm not savvy enough to tease this out beyond
"inspection." The weblog entry has the original distribution, plots,
and whatnot explaining my question in more detail. My question(s) are
repeated at the bottom of the post, as well as this email address. Any
help or insights are appreciated; no doubt, I've done something...
well, wrong.

Many thanks,

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!

More information about the R-help mailing list