7
$\begingroup$

I have system described by a statement like "The failure probability per week at 20 Celsius degree is 3.5%", how can I simulate such a system?

The simulation I have in mind should answer to questions like "how many failure will happen in 13 days?"

The simulation should for example produce table like the following one:

timestamp,number of failures at the timestamp
2015-01-16T07:00:00Z,0
2015-01-17T07:00:00Z,0
2015-01-18T07:00:00Z,0
2015-01-19T07:00:00Z,1
2015-01-20T07:00:00Z,1
2015-01-21T07:00:00Z,1
2015-01-22T07:00:00Z,2

I would like to simulate such a system in R, maybe using a Poisson distribution, but I have no idea on how to start, I think it should be something quite simple but maybe I really miss some basic background, may you suggest an example or a tutorial?

$\endgroup$
  • 1
    $\begingroup$ The Poisson process seems to be a good idea. Do you know what is it ? But do you really need all the failures during the time of observation, or only the total number of failures ? In the second case, there's no need of a Poisson process, just a Poisson distribution. $\endgroup$ – Stéphane Laurent Jan 16 '15 at 10:26
  • $\begingroup$ I think I need the Poisson process, I am not familiar with it... I am not able to relate my probability expressed in percent to the Poisson's "lambda". $\endgroup$ – Alessandro Jacopson Jan 16 '15 at 11:10
  • 1
    $\begingroup$ Let $T$ be the period of observations. Then if you use the Poisson distribution ${\cal P}(\lambda T)$, you can interpret $\lambda$ as the rate of failure. But I'm not sure to understand "failure probability". $\endgroup$ – Stéphane Laurent Jan 16 '15 at 11:32
  • $\begingroup$ NB: in my previous comment, ${\cal P}(\lambda T)$ is a model for the total number of failures on the period of length $T$. $\endgroup$ – Stéphane Laurent Jan 16 '15 at 11:33
  • $\begingroup$ Moreover I'm not sure to understand the real experiment you want to model. Is there a fixed number of "operations" per day, and these operations are subject to fail ? $\endgroup$ – Stéphane Laurent Jan 16 '15 at 19:07
6
+50
$\begingroup$

First consider the case we have just one machine. We will have to make some assumptions, and one common and simple one is to model the failure time as exponentially distributed. This means that the failure rate is constant (the probability of failure between time t and t+1, given survival up to time t is constant for all t) (see wiki for more info).

The time to failure, let's denote it by $T \sim Exp(\lambda t)$ where t denotes time in days. We first need to find $\lambda$, and since we know the probability of failure in one week is 3.5%, we get: $P(T < 7) = 1-e^{-7 \lambda} = 0.035$. Working this out, we get $\lambda = 0.00221$.

Now to simulate the failures for $N$ machines as time progresses, we can draw $N$ samples from an Exponential distribution with $\lambda = 0.00221$. This will give you failure times of the $N$ machines in days.

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ This also works well because of the forgetfulness property of the exponential: given you have survived this last, the probability you fail this next week is equal to that of last week, i.e. your survival is independent of how long you have survived for. (A consequence of a constant hazard rate). This means that if we start with $N$ machines, there will still always be 3.5% failure each week (on average). $\endgroup$ – Cam.Davidson.Pilon Feb 5 '15 at 4:51
  • $\begingroup$ Can you check your math? I get lambda=-log(1-0.035)/7 and so lambda = 0.00509 $\endgroup$ – DWin Jul 18 '15 at 23:56
1
$\begingroup$

It seems like you don't need information more frequently than daily, so the most obvious approach would be to compute the distribution of the number of failures per day, and then simulate from that.

Alternatively, you can simulate the exponential inter-event times and go from that. This gives intra-day precision if you need information at that level.

"how many failure will happen in 13 days?"

You can work this out without simulation. To do it with the daily simulation, you could simulate sets of 13 days many times and keep the simulated distribution of values.

This is very easy in R.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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