Q:

How to simulate a system where "the failure probability per week is 3.5%"?

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?

A:

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.

