Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11945 > unrolled thread

Re: Get Distribution from Interpolated Function

Started byTomas Garza <tgarza10@msn.com>
First post2012-10-04 03:42 +0000
Last post2012-10-05 06:40 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Get Distribution from Interpolated Function Tomas Garza <tgarza10@msn.com> - 2012-10-04 03:42 +0000
    Re: Get Distribution from Interpolated Function Murta <rodrigomurtax@gmail.com> - 2012-10-05 06:40 +0000

#11945 — Re: Get Distribution from Interpolated Function

FromTomas Garza <tgarza10@msn.com>
Date2012-10-04 03:42 +0000
SubjectRe: Get Distribution from Interpolated Function
Message-ID<k4j0in$7p3$1@smc.vnet.net>
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@gmail.com
> Subject: Get Distribution from Interpolated Function
> To: mathgroup@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
>

[toc] | [next] | [standalone]


#11951

FromMurta <rodrigomurtax@gmail.com>
Date2012-10-05 06:40 +0000
Message-ID<k4lvcu$d2s$1@smc.vnet.net>
In reply to#11945
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@gmail.com
> 
> > Subject: Get Distribution from Interpolated Function
> 
> > To: mathgroup@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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web