{ From user Lonnie, Model Custom_distribution_ at Thu, Jul 24, 2008 10:57 AM~~
}
Softwareversion 4.1.1
{ System Variables with non-default values: }
Samplesize := 10K
Sampletype := 2
{!40000|Att_contlinestyle Run: 0}
Typechecking := 1
Checking := 1
Saveoptions := 2
Savevalues := 0
Distresol := 50
{!40000|Att_contlinestyle Graph_primary_valdim: 1}
{!40000|Att_catlinestyle Graph_primary_valdim: 9}
{!40000|Att_catlinestyle Graph_stats_valdim: 9}
{!40000|Att_contlinestyle Graph_pdf_valdim: 1}
Model Custom_distribution_
Title: Custom Distribution Functions
Description: Analytica User Group Webinar of 24 July 2008~
~
Analytica comes with most of the commonly seen distributions built-in~~
, and many additions distribution functions available in the standard~~
libraries. However, in specific application areas, you may encounter~~
distribution types that aren't already provided, or you may wish to ~~
create a variation on an existing distribution based on a different s~~
et of parameters. In these cases, you can create your own User-Define~~
d Distribution Function (UDDF). Once you've created your function, yo~~
u can utilize it within your model like you would any other distribut~~
ion function. ~
~
User-defined distribution functions are really just instances of User~~
-Defined Functions (UDFs) that behave in certain special ways. This w~~
ebinar discusses the various functionalities that a user-defined dist~~
ribution function should exhibit and various related considerations. ~~
Most fundamentally, the defining feature of a UDDF is that it returns~~
a median value when evaluated in Mid mode, but a sample indexed by R~~
un when evaluated from Sample mode. This contrasts with non-distribut~~
ion functions whose behavior does not depend on the Mid/Sample evalua~~
tion mode. Custom distributions are most often implemented in terms o~~
f existing distributions (which includes Inverse CDF methods for impl~~
ementing distributions), so that this property is achieved automatica~~
lly since the existing distributions already have this property. But ~~
in less common cases, UDDFs may treat the two evaluation modes differ~~
ently. ~
~
When you create a UDDF, you may also want to ensure that it works wit~~
h Random() to generate a single random variate, and supports the Over~~
parameter for generating independent distributions. You may also wan~~
t to create a companion function for computing the density (or probab~~
ility for discrete distributions) at a point, which may be useful in ~~
a number of contexts including, for example, during importance sampli~~
ng. I'll show you how these features are obtained. ~
~
There are several techniques that are often used to implement distrib~~
ution functions. The two most common, especially in Analytica, are th~~
e Inverse CDF technique and the transformation from existing distribu~~
tions method. I'll explain and show examples of both of these. The In~~
verse CDF is particularly convenient in that it supports all sampling~~
methods (Median Latin Hypercube, Random Latin Hypercube, and Monte C~~
arlo). ~
Author: Lonnie
Date: Thu, Jul 24, 2008 9:59 AM
Saveauthor: Lonnie
Savedate: Thu, Jul 24, 2008 10:57 AM
Defaultsize: 48,24
Diagstate: 1,1,7,582,387,17
Fontstyle: Arial, 15
Fileinfo: 0,Model Custom_distribution_,2,2,0,0,W:\Training\User Group ~~
Webinars\Custom Distribution Functions.ANA
Chance Ch1
Definition: Gamma(2, Over: J)
Nodelocation: 104,64,1
Nodesize: 48,24
Valuestate: 2,40,50,550,378,1,SAMP
Reformval: [Undefined,Undefined,Undefined,Undefined,1,1]
{!40000|Att_xrole: -1}
{!40000|Att_yrole: -2}
{!40000|Att_coordinateindex: J}
Index J
Title: J
Definition: 1..5
Nodelocation: 232,64,1
Nodesize: 48,24
Function Logweibull(mode,scale : atomic ; Over : ... optional atomic ;~~
~
singleSampleMethod : optional hidden scalar )
Title: LogWeibull
Description: The Log-Weibull distribution, aka Fisher-Tippet or Gumbel~~
distribution, used for modeling extreme events.
Definition: var p := Uniform(0,1, singleSampleMethod : singleSampleMet~~
hod);~
mode - scale * ln( -ln(p))
Nodelocation: 112,128,1
Nodesize: 48,24
Windstate: 2,400,54,476,224
Paramnames: mode,scale,Over
Chance X
Title: x
Definition: LogWeibull(x_mode,x_scale)
Nodelocation: 224,192,1
Nodesize: 48,24
Valuestate: 2,266,44,539,330,1,SAMP
Reformval: [Undefined,Undefined,Undefined,Undefined,1,1]
{!40000|Att_xrole: -2}
{!40000|Att_yrole: -4}
{!40000|Att_coordinateindex: X_mode}
Variable X_mode
Title: x mode
Definition: Table(Self)(~
0,0.5,1,0.5,2)
Indexvals: ['m=0,s=1','m=0.5,s=1','m=1,s=2','m=.5,s=1.5','m=2,s=1.5']~~
Nodelocation: 104,192,1
Nodesize: 48,24
Defnstate: 2,56,49,416,303,0,MIDM
{!40000|Att_previndexvalue: ['m=0,s=1','m=0.5,s=1','m=1,s=2','m=.5,s=1~~
.5','m=2,s=1.5']}
Variable X_scale
Title: x scale
Definition: Table(X_mode)(~
1,1,2,1.5,1.5)
Nodelocation: 104,240,1
Nodesize: 48,24
Defnstate: 2,445,57,416,303,0,MIDM
Chance Y
Title: y
Definition: LogWeibull(3,5,Over:J)
Nodelocation: 336,192,1
Nodesize: 48,24
Valuestate: 2,134,59,416,303,1,SAMP
Reformval: [Undefined,J,Undefined,Undefined,Undefined,1]
{!40000|Att_coordinateindex: J}
Chance Z
Title: z
Definition: Random( LogWeibull( 3,4 ) , Over:J )
Nodelocation: 448,192,1
Nodesize: 48,24
Valuestate: 2,457,54,416,303,0,MIDM
Function Maxwell(a : scalar ; Over : ... optional atomic ;~
singleSampleMethod : optional hidden scalar)
Title: Maxwell(a)
Description: The Maxwell-Boltzman distribution. Used in statistical m~~
echanics for modeling the speed of particles.
Definition: If IsSampleEvalMode or not IsNotSpecified(singleSampleMeth~~
od) Then ~
sqrt( Normal(0,a,singleSampleMethod:singleSampleMethod)^2 +~
Normal(0,a,singleSampleMethod:singleSampleMethod)^2 +~
Normal(0,a,singleSampleMethod:singleSampleMethod )^2)~
Else~
1.5381722544 * a
Nodelocation: 104,312,1
Nodesize: 48,24
Windstate: 2,356,48,515,346
Paramnames: a,Over
Chance Particle_speed
Title: Particle speed
Definition: Maxwell(5)
Nodelocation: 224,312,1
Nodesize: 48,24
Valuestate: 2,312,55,496,325,1,PDFP
Chance Random_particle_spee
Title: Random particle speed
Definition: Random ( Maxwell(5 ), Over:J )
Nodelocation: 224,369,1
Nodesize: 48,31
Valuestate: 2,181,49,416,303,0,MIDM
Index Xx
Title: xx
Definition: sequence(0,10,0.1)
Nodelocation: 104,448,1
Nodesize: 48,24
Function Dens_rice(x, v : scalar)
Title: Dens Rice
Description: The Rice distribution
Definition: x * BesselI(x*v, 0) * exp( - (x^2 + v^2))
Nodelocation: 360,312,1
Nodesize: 48,24
Paramnames: x,v
Variable Graph_of_rice
Title: Graph of rice
Definition: Dens_Rice(xx,1)
Nodelocation: 224,448,1
Nodesize: 48,24
Valuestate: 2,340,50,479,344,1,MIDM
Function Rice( Over : ... optional atomic ; singleSampleMethod : optio~~
nal hidden scalar)
Title: Rice
Description: The Rice distribution
Definition: Var x := Sequence(0,5,0.1);~
Probdist( Dens_Rice(x,1), x, x, singleSampleMethod : singleSampleMeth~~
od )
Nodelocation: 360,376,1
Nodesize: 48,24
Windstate: 2,338,267,476,224
Paramnames: Over
Chance Rice_x
Title: rice x
Definition: Rice( )
Nodelocation: 360,448,1
Nodesize: 48,24
Valuestate: 2,45,118,667,371,1,PDFP
Chance Rice_variate
Title: rice variate
Definition: Random ( Rice( ) )
Nodelocation: 472,448,1
Nodesize: 48,24
Valuestate: 2,417,52,416,303,0,MIDM
Close Custom_distribution_