Re: mathematica fit data to inverse gamma distribution
- To: mathgroup at smc.vnet.net
- Subject: [mg117402] Re: mathematica fit data to inverse gamma distribution
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 17 Mar 2011 06:33:04 -0500 (EST)
On 3/16/11 at 6:25 AM, mammasis82 at hotmail.com (Alex) wrote: >I am trying to obtain same figure that is provided in Mathematica's >website related to fitting an inverse gamma to a dataset. Here is >the code I enter: >data1 = RandomVariate[InverseGammaDistribution[0.5, 3], 10^4]; Show[ >Histogram[data1, {0, 20, 1}, "PDF"], Plot[PDF[ >TruncatedDistribution[{0, 20}, InverseGammaDistribution[0.5, 3]], >x], {x, 0, 20}, PlotStyle -> Thick]] >and here is the error I receive: >Histogram::hspec: The height specification PDF is not one of the >named height functions or a function that can be used to compute the >heights for each bin. >> Show::"gcomb" : StyleBox[Could not combine >the graphics objects in ..... When I copy from your post into a Mathematica notebook, your code does exactly what I would expect with no error message. Perhaps, in the actual notebook when you entered "PDF" for specifying the histogram you unintentionally entered an extra invisible character in the string. If so, Mathematica would treat this as a different specification for the histogram and would fail to find a match resulting in the error message you report above.