MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Defining a distribution

Hi Omri

Have a look at 

where you will find a distribution-defining statement via a given pdf such as:

dist = ProbabilityDistribution[(Sqrt[2]/Pi) (1/(1 + x^4)), {x, -Infinity, Infinity}];

You can then generally draw samples from "dist" via such as:

data = RandomVariate[dist, 10^5];


However, if you look at:, and try:

\[ScriptCapitalD] = 
  ProbabilityDistribution[2^(-x - 1), {x, 0, \[Infinity], 1}]; (* copied from Help page *)

(* this plot works *)
DiscretePlot[Evaluate@CDF[\[ScriptCapitalD], x], {x, 0, 8}, 
 ExtentSize -> Left]

RandomVariate[ \[ScriptCapitalD  ]

I at least get a "not implemented message". Oh dear.

I tried using the partial sum to k, say, (1-2^(-1-k)) and then ProbabilityDistribution[ "CDF", 1-2^(-1-k), {k, 0, inf, 1} ] but this does not even give a valid ProbabilityDistribution[] object.



>>> On 16/12/2010 at 9:48 pm, in message <201012161048.FAA11797 at>,
omri-piano <omrit1248 at> wrote:
> Hi,
> I would like to define a statistical distribution of my own. I would like to 
> sample from it, as when sampling from one of the standard Mathematica 
> distributions, like RandomInteger[BinomialDistribution[n,p]].
> The pdf of my distribution should look like:
> MyDistribution [j_, p_, n_]:=Binomial[n,(n*j)]*p^(n*j)*(1-p)^(n-n*j)
> Is that possible?
> Thanks,
> Omri.

  • Prev by Date: Re: Plotting anomaly with a staircase function
  • Next by Date: Re: Help with Loop to Rule Based Algorithm
  • Previous by thread: Defining a distribution
  • Next by thread: Placing the "&"