Re: Get Distribution from Interpolated Function
- To: mathgroup at smc.vnet.net
- Subject: [mg128293] Re: Get Distribution from Interpolated Function
- From: Murta <rodrigomurtax at gmail.com>
- Date: Fri, 5 Oct 2012 02:49:47 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <20121003070909.A52016881@smc.vnet.net> <k4j0in$7p3$1@smc.vnet.net>
On Thursday, October 4, 2012 12:43:47 AM UTC-3, Tomas Garza wrote: > I think the Histogram is working fine. The problem is with randonData, all of whose elements are less than 1.Note that dist is not a probability distribution, since in my example > > In[3]:= NIntegrate[PDF[dist, x], {x, 0, 10}] > > > > Out[3]= 13.6285 > > If you first normalize dist (i.e., divide dist by NIntegrate[PDF[dist, x], {x, 0, 10}]), then you'll get a histogram which more or less resembles the curve form. > > --Tomas > > > > > From: rodrigomurtax at gmail.com > > > Subject: Get Distribution from Interpolated Function > > > To: mathgroup at smc.vnet.net > > > Date: Wed, 3 Oct 2012 03:09:09 -0400 > > > > > > Hi All > > > > > > I'm trying to get a distribution from an interpolated function but with no success. > > > > > > (*Creating Dist from interpolation*) > > > ff = Interpolation[Table[{i, 1 + RandomReal[1]}, {i, 0, 10, 1}], Method -> "Spline"]; > > > dist = ProbabilityDistribution[ff[x], {x, 0, 10}]; > > > > > > (*Plot Interpolation ok!*) > > > Plot[ff[x], {x, 0, 10}] > > > > > > (*Plot Dist ok!*) > > > Plot[Evaluate@PDF[dist, x], {x, 0, 10}] > > > > > > (*do not work as spected, the histogram don't have the curve format*) > > > randonData = RandomVariate[dist, 100000]; > > > Histogram[randonData, {0.1}, "Probability", PlotRange -> {{0, 10}, All}] > > > > > > tks in advance > > > Murta > > > Bob tks. It's just what I need
- References:
- Get Distribution from Interpolated Function
- From: Murta <rodrigomurtax@gmail.com>
- Get Distribution from Interpolated Function