MathGroup Archive 2007

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

Search the Archive

Re: Triangular Distribution in Mathematica


negedea at googlemail.com wrote:
> Dear all,
>
> Does any one know how to use triangular distribution in Mathematica?
> Does any one have an add-in? Or a formula that works? I want to get
> the PDF function, plot and the first four moments, mean, variance,
> skew, kurtosis. I have the following parameters for the distribution
> minimum value 270, maximum 415 and  likeliest or mode 392.
>
> Thanking in Adavance,
>
> Negede
>
>   

Here is a definition for the triangular distribution pdf along with 
computations for the mean, variance, skewness and kurtosis and the plot 
command for your particular distribution.

In[1]:= $Post=InputForm;

Out[1]//InputForm= Null

In[2]:= trianglePDF[min_, max_, mode_, x_] :=
         Piecewise[{{(2*(-min + x))/((max - min)*(-min + mode)),
               min <= x <= mode}, {(2*(max - x))/((max - min)*(max - 
mode)),
               mode < x <= max}}]

Out[2]//InputForm= Null

In[3]:= mu = Integrate[x*trianglePDF[270, 415, 392, x], {x, 270, 415}]

Out[3]//InputForm= 359

In[4]:= var = Integrate[(x - mu)^2*trianglePDF[270, 415, 392, x], {x, 270,
           415}]

Out[4]//InputForm= 6073/6

In[5]:= Integrate[(x - mu)^3*trianglePDF[270, 415, 392, x], {x, 270, 415}]/
         var^(3/2)

Out[5]//InputForm= (-493416*Sqrt[6/6073])/30365

In[6]:= Integrate[(x - mu)^4*trianglePDF[270, 415, 392, x], {x, 270, 415}]/
         var^2

Out[6]//InputForm= 12/5

In[7]:= Plot[trianglePDF[270, 415, 392, x], {x, 270, 415}]


Darren Glosemeyer
Wolfram Research


  • Prev by Date: Re: Triangular Distribution in Mathematica
  • Next by Date: Re: fastest way to add up a billion numbers
  • Previous by thread: Triangular Distribution in Mathematica
  • Next by thread: Re: Triangular Distribution in Mathematica