Learn R Programming

fixedTimeEvents (version 1.0.1)

dLiland: The distribution of distances between discrete events in fixed time/space (the Liland distribution)

Description

Density, distribution function, quantile function and random generation for the Liland distribution with R trials and r successes.

Usage

dLiland(x, R, r, warn = FALSE)
pLiland(q, R, r, lower.tail = TRUE, warn = FALSE)
qLiland(p, R, r)
rLiland(n, R, r)

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

n

number of observations.

R

number of trials.

r

number of successes.

warn

logical indicating if a warning should be issued if approximation is used.

lower.tail

logical indicating if the lower tail of the distribution should be summed.

Value

dLiland gives the probability mass, pLiland gives the distribution function, qLiland gives the quantile function, and rLiland generates random Liland values.

Details

The Liland distribution has probability mass $$ f(X=x;R,r) = \frac{{R-x \choose r-1}}{{R \choose r}}$$ where \(x\) is the distance between consecutive successes, \(R\) is the number of trials and \(r\) is the number of successes.

References

Liland, KH & Snipen, L, FixedTimeEvents: An R package for the distribution of distances between discrete events in fixed time, SoftwareX 5 (2016).

See Also

Liland, Liland.test, simLiland

Examples

Run this code
# NOT RUN {
dLiland(19, R = 1949, r = 162)
pLiland(19, R = 1949, r = 162)
qLiland(0.5, R = 1949, r = 162)
plot( pLiland(1:100, R = 1949, r = 162) )

## QQ-plot of Liland distribution and random Liland values
R <- 2000
r <- 120
n <- 1000
samp <- rLiland(n,R,r)
theo <- qLiland(ppoints(n),R,r)
qqplot(theo,samp,
       xlab='F(x;2000,120)', ylab='Sample (1000)', axes=FALSE)
axis(1,at=c(0,40,80,120))
axis(2,at=c(0,40,80,120))
box()
qqline(samp, distribution = function(p)qLiland(p,R=2000,r=120), col='gray',lty=2)
# }

Run the code above in your browser using DataLab