This small package contains the Liland distribution for distances between discrete events in fixed time with probability mass, cumulative distribution, quantile function, random number generator, simulation functions and a test for over representation of short distances.

An example of its use is found in bacterial gene regulation where genes along a chromosome are regulated or not regulated. One may ask if the distances between regulated genes are random or tend to cluster, e.g. as operons. In the following example we have \(R=1949\) genes (trials) of which \(r=162\) are regulated (success).

```
library(fixedTimeEvents)
<- 1949; r <- 162
R Liland(R, r)
```

```
## Mean Variance
## 11.96319 129.55528
```

```
<- 1949; r <- 162
R <- dLiland(1:100, R, r)
dL plot(dL, type = 'l', xlab = "distance", ylab = "probability mass")
```

A test for over representation of short distances can be performed, e.g. for distances shorter than 2 (\(x<2\)).

```
<- Liland.test(1:100, 1, R, r)
Lt Liland.crit(1, R, r)
```

`## [1] 19`

```
plot(Lt, type='l', xlab='#(x<2)', ylab='p-value')
points(73, Liland.test(73, 1, R, r), col = 2)
```

A comparison between distances obtained from sampling from the Bernoulli distribution with a fixed number of successes and the theoretical values from the Liland distribution follows.

```
<- simLiland(5000, 15,5) # 5000 samples, R = 15, r = 5
sL qqplot(dLiland(1:length(sL),15,5),sL,
xlab='F(x;15,5)', ylab='Sample (5000)')
abline(0,1, lty=2, col=2)
```