# [R] A strange question on probability

Jim Lemon bitwrit at ozemail.com.au
Tue Jun 29 10:42:35 CEST 2004

```On Tuesday 29 June 2004 01:48 pm, Steve S wrote:
> Dear All,
>
> I wonder if there is a probability distribution where you can specify when
> a certain event start and finish within a fixed period? For example I might
> specify the number of period to be 5, and a random vector from this
> distribution might give me:
> 0 1 1 1 0
>
> where 1 is always adjacent to each other?
>
> This can never happen: 0 0 1 0 1 for example.
>
Well, I'll have a go. Let's call it the start-finish distribution. We have a
p (period) and d (duration). As there must be an "off" observation (otherwise
we don't know the duration), It's fairly easy to enumerate the outcomes for a
given period:

d	start(s)	finish(f)	count
1	1:n-1	2:n	n-1
2	1:n-2	3:n	n-2
...
n-1	1	n-1	1

Assuming that all outcomes are equally likely, the total number of outcomes
is:

n(n-1)/2

thus the probability of a given d occurring is:

P[d|n] = 2(n-d)/n(n-1)

The probabilities of s and f over all d are inverse over the values k in 1:n

P[s=k|n] = (n-k-1)/(n-1)
P[f=k|n] = (k-1)/(n-1)

giving, I think, a monotonic function for s and f.

> My apology for this strange question!
>
My apology if this is no use at all.

Jim

```