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

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu 19 May 2005 - 02:14:09 EST

Note that the gamma distribution seems to work well here. After running Andy's code run this to see both superimposed on the same graph:

gparms <- fitdistr(dd, "gamma")[[1]]
yyg <- dgamma(xx, gparms[1], gparms[2])
lines(xx, yyg, col=3)

On 5/18/05, apjaworski@mmm.com <apjaworski@mmm.com> wrote:
>
>
> Matt,
>
> 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.
>
> Cheers,
>
> Andy
>
> __________________________________
> Andy Jaworski
> 518-1-01
> Process Laboratory
> 3M Corporate Research Laboratory
> -----
> E-mail: apjaworski@mmm.com
> Tel: (651) 733-6092
> Fax: (651) 736-3122
>
> Matt Jadud
> <jadudm@gmail.com
> > To
> Sent by: R-help@stat.math.ethz.ch
> r-help-bounces@st cc
> at.math.ethz.ch
> Subject
> [R] 'fitdistr' and two views of the
> 05/18/2005 09:34 same data?
> AM
>
> Please respond to
> Matt Jadud
> <jadudm@gmail.com
> >
>
> Hello,
>
> I have detailed (with pictures and whatnot) my question on my weblog at
>
> http://www.cs-ed.org/blogs/mjadud/archives/2005/05/a_question_abou.html
>
> 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,
> Matt
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu May 19 05:05:20 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:50 EST