4
$\begingroup$

For my Monte Carlo simulation (job related) I needed to generate random numbers with conditional probability of related distribution. (example: given that an item has been working for 1200 hours, generating a proper random failure time related to its time-to-failure distribution.)

I searched the web and couldn't find a formula or process to generate this kind of dataset.

In my case I am only interested in 2 distributions:

  1. exponential
  2. weibull

Question 1: My opinion for exponential is "Since exponential distribution has memoryless property then generating random number with conditional probability is still same as generating random number without any condition."

Am I right?

Question 2: I couldn't find any source for weibull distribution. Can you please help me on how to generate weibull random number with conditional probability.

$\endgroup$

1 Answer 1

5
$\begingroup$

If I understand correctly, you are correct concerning exponential distribution: the failure time $T$, conditional to $T > t_1$, is $t_1 + T'$ with $T' \sim \mathcal E(\lambda)$.

Weibull distribution has the property (which may be used as a definition) that $$ Pr( T > t ) = e^{-\left( {t\over \lambda} \right)^k}. $$ Thus, the distribution of the failure time conditional to $T > t_1$ verifies $$ Pr( T > t_1 + t | T > t_1) = e^{ -{1\over \lambda^k}\left( (t_1+t)^k - t_1^k\right) }. $$ You can generate $T$ as $t_1 + T'$ with $T'$ having the above distribution. This can be done by inverse transform sampling.

Concretely, if $U$ is uniform on $(0,1)$, let $T' = F^{-1}(U)$ with $F(t) = 1-e^{ -{1\over \lambda^k}\left( (t_1+t)^k - t_1^k\right) }$, that is $$ T' = \left(t_1^k - \lambda^k \log(1-U) \right)^{1\over k} - t_1, $$ where $\log$ is the natural logarithm. You can simplify this by noting that $U$ and $1-U$ have the same distribution so $\log U$ will do it.

$\endgroup$
5
  • $\begingroup$ thank you so much for your quick and detailed help Elvis. $\log U$ is I think $\ln U$ with base e; right? $\endgroup$ May 22, 2017 at 8:34
  • 1
    $\begingroup$ Right, this is the natural logarithm. I’ll edit the answer accordingly. $\endgroup$
    – Elvis
    May 22, 2017 at 8:36
  • 1
    $\begingroup$ @AndreChenier I also fixed a typo — a sign error in the last formula! $\endgroup$
    – Elvis
    May 22, 2017 at 8:43
  • $\begingroup$ oh great, thanks cause I won't be able to verifiy the formula & I'd work with it. thanks again. It's been many years that I forgot advanced math. (yes this is advanced math for me by the time being :) $\endgroup$ May 22, 2017 at 8:47
  • $\begingroup$ You can test the formula by generating samples 1) using the formula, and 2) using rejection sampling (generate many $T$ values and keep only values above $t_1$). Compare the two samples with e.g. a qq-plot. Good luck! $\endgroup$
    – Elvis
    May 22, 2017 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.