Appendix A: Generating Random Numbers from a Distribution: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
 
(21 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Template:bsbook|A3}}
{{Template:bsbook|Appendix A|Generating Random Numbers from a Distribution}}
 
Simulation involves generating random numbers that belong to a specific distribution. We will illustrate this methodology using the Weibull distribution.  
Simulation involves generating random numbers that belong to a specific distribution. We will illustrate this methodology using the Weibull distribution.  


=Generating Random Times from a Weibull Distribution=
=Generating Random Times from a Weibull Distribution=


The <math>cdf</math>  of the 2-parameter Weibull distribution is given by,
The ''cdf'' of the 2-parameter Weibull distribution is given by:
<br>


::<math>F(T)=1-{{e}^{-{{\left( \tfrac{T}{\eta } \right)}^{\beta }}}}.</math>
::<math>F(T)=1-{{e}^{-{{\left( \tfrac{T}{\eta } \right)}^{\beta }}}}\,\!</math>
<br>


The Weibull reliability function is given by,
The Weibull reliability function is given by:
<br>


::<math>\begin{align}
::<math>\begin{align}
  R(T)= & 1-F(t) \\  
  R(T)= & 1-F(t) \\  
  = & {{e}^{-{{\left( \tfrac{T}{\eta } \right)}^{\beta }}}}.  
  = & {{e}^{-{{\left( \tfrac{T}{\eta } \right)}^{\beta }}}}   
\end{align}</math>
\end{align}\,\!</math>


<br>
To generate a random time from a Weibull distribution, with a given  <math>\eta \,\!</math>  and  <math>\beta \,\!</math>, a uniform random number from 0 to 1,  <math>{{U}_{R}}[0,1]\,\!</math> , is first obtained.  The random time from a weibull distribution is then obtained from:
To generate a random time from a Weibull distribution, with a given  <math>\eta </math>  and  <math>\beta </math>  a uniform random number from 0 to 1,  <math>{{U}_{R}}[0,1]</math> , is first obtained.  The random time from a weibull distribution is then obtained from:


<br>
::<math>{{T}_{R}}=\eta \cdot {{\left\{ -\ln \left[ {{U}_{R}}[0,1] \right] \right\}}^{\tfrac{1}{\beta }}}\,\!</math>
::<math>{{T}_{R}}=\eta \cdot {{\left\{ -\ln \left[ {{U}_{R}}[0,1] \right] \right\}}^{\tfrac{1}{\beta }}}.</math>


<br>
==Conditional==
==Conditional==
The Weibull conditional reliability function is given by,
The Weibull conditional reliability function is given by:
<br>
 
::<math>R(T,t)=\frac{R(T+t)}{R(T)}=\frac{{{e}^{-{{\left( \tfrac{T+t}{\eta } \right)}^{\beta }}}}}{{{e}^{-{{\left( \tfrac{T}{\eta } \right)}^{\beta }}}}},</math>
::<math>R(t|T)=\frac{R(T+t)}{R(T)}=\frac{{{e}^{-{{\left( \tfrac{T+t}{\eta } \right)}^{\beta }}}}}{{{e}^{-{{\left( \tfrac{T}{\eta } \right)}^{\beta }}}}}\,\!</math>
<br>
 
or,  
The random time would be the solution for <math>t\,\!</math> for <math>R(t|T)={{U}_{R}}[0,1]\,\!</math>.
<br>
<br>


=BlockSim's Random Number Generator (RNG)=
=BlockSim's Random Number Generator (RNG)=


Internally ReliaSoft's BlockSim uses an algorithm based on L'Ecuyer's [RefX] random number generator with a post Bays-Durham shuffle.  The RNG's period is aproximately 10^18. The RNG passes all currently known statistical tests, within the limits the machine's precion, and for a number of calls (simulation runs) less than the period. If no seed is provided the algorithm uses the machines clock to initialize the RNG.
Internally, ReliaSoft's BlockSim uses an algorithm based on L'Ecuyer's [RefX] random number generator with a post Bays-Durham shuffle.  The RNG's period is approximately 10^18. The RNG passes all currently known statistical tests, within the limits the machine's precision, and for a number of calls (simulation runs) less than the period. If no seed is provided the algorithm uses the machines clock to initialize the RNG.


=References=
=References=
#L'Ecuyer, P., 1988, Communications of the ACM, vol. 31, pp.724-774
#L'Ecuyer, P., 1988, Communications of the ACM, vol. 31, pp.724-774
#L'Ecuyer, P., 2001, Proceedings of the 2001 Winter Simulation Conference, pp.95-105
#L'Ecuyer, P., 2001, Proceedings of the 2001 Winter Simulation Conference, pp.95-105
#Press, William H., Teukolsky, Saul A., Vetterling, William T., Flannery, Brian R., Numerical
#William H., Teukolsky, Saul A., Vetterling, William T., Flannery, Brian R., Numerical Recipes in C: The Art of Scientific Computing, Second Edition, Cambridge University Press, 1988.
#Recipes in C: The Art of Scientific Computing, Second Edition, Cambridge University Press, 1988.
#Peters, Edgar E., Fractal Market Analysis: Applying Chaos Theory to Investment & Economics, John Wiley & Sons, 1994.
#Peters, Edgar E., Fractal Market Analysis: Applying Chaos Theory to Investment & Economics, John Wiley & Sons, 1994.
#Knuth, Donald E., The Art of Computer Programming: Volume 2 - Seminumerical Algorithms, Third Edition, Addison-Wesley, 1998.
#Knuth, Donald E., The Art of Computer Programming: Volume 2 - Seminumerical Algorithms, Third Edition, Addison-Wesley, 1998.

Latest revision as of 19:24, 15 September 2023

New format available! This reference is now available in a new format that offers faster page load, improved display for calculations and images, more targeted search and the latest content available as a PDF. As of September 2023, this Reliawiki page will not continue to be updated. Please update all links and bookmarks to the latest reference at help.reliasoft.com/reference/system_analysis

Chapter Appendix A: Appendix A: Generating Random Numbers from a Distribution


BlockSimbox.png

Chapter Appendix A  
Appendix A: Generating Random Numbers from a Distribution  

Synthesis-icon.png

Available Software:
BlockSim

Examples icon.png

More Resources:
BlockSim examples

Simulation involves generating random numbers that belong to a specific distribution. We will illustrate this methodology using the Weibull distribution.

Generating Random Times from a Weibull Distribution

The cdf of the 2-parameter Weibull distribution is given by:

[math]\displaystyle{ F(T)=1-{{e}^{-{{\left( \tfrac{T}{\eta } \right)}^{\beta }}}}\,\! }[/math]

The Weibull reliability function is given by:

[math]\displaystyle{ \begin{align} R(T)= & 1-F(t) \\ = & {{e}^{-{{\left( \tfrac{T}{\eta } \right)}^{\beta }}}} \end{align}\,\! }[/math]

To generate a random time from a Weibull distribution, with a given [math]\displaystyle{ \eta \,\! }[/math] and [math]\displaystyle{ \beta \,\! }[/math], a uniform random number from 0 to 1, [math]\displaystyle{ {{U}_{R}}[0,1]\,\! }[/math] , is first obtained. The random time from a weibull distribution is then obtained from:

[math]\displaystyle{ {{T}_{R}}=\eta \cdot {{\left\{ -\ln \left[ {{U}_{R}}[0,1] \right] \right\}}^{\tfrac{1}{\beta }}}\,\! }[/math]

Conditional

The Weibull conditional reliability function is given by:

[math]\displaystyle{ R(t|T)=\frac{R(T+t)}{R(T)}=\frac{{{e}^{-{{\left( \tfrac{T+t}{\eta } \right)}^{\beta }}}}}{{{e}^{-{{\left( \tfrac{T}{\eta } \right)}^{\beta }}}}}\,\! }[/math]

The random time would be the solution for [math]\displaystyle{ t\,\! }[/math] for [math]\displaystyle{ R(t|T)={{U}_{R}}[0,1]\,\! }[/math].

BlockSim's Random Number Generator (RNG)

Internally, ReliaSoft's BlockSim uses an algorithm based on L'Ecuyer's [RefX] random number generator with a post Bays-Durham shuffle. The RNG's period is approximately 10^18. The RNG passes all currently known statistical tests, within the limits the machine's precision, and for a number of calls (simulation runs) less than the period. If no seed is provided the algorithm uses the machines clock to initialize the RNG.

References

  1. L'Ecuyer, P., 1988, Communications of the ACM, vol. 31, pp.724-774
  2. L'Ecuyer, P., 2001, Proceedings of the 2001 Winter Simulation Conference, pp.95-105
  3. William H., Teukolsky, Saul A., Vetterling, William T., Flannery, Brian R., Numerical Recipes in C: The Art of Scientific Computing, Second Edition, Cambridge University Press, 1988.
  4. Peters, Edgar E., Fractal Market Analysis: Applying Chaos Theory to Investment & Economics, John Wiley & Sons, 1994.
  5. Knuth, Donald E., The Art of Computer Programming: Volume 2 - Seminumerical Algorithms, Third Edition, Addison-Wesley, 1998.