Matching: The Generalized Matching Distribution

Description Usage Arguments Value References Examples

Description

Density, distribution function, quantile function and random generation for the generalized matching distribution with parameters size, trials and prob. The distribution is for the total number of matches over all trials. In each trial the player initially matches objects independently with probability prob and then allocates remaining objects using a random permutation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
dmatching(x, size, trials = 1, prob = 0, log = FALSE, approx = (trials > 100))

pmatching(
  q,
  size,
  trials = 1,
  prob = 0,
  lower.tail = TRUE,
  log.p = FALSE,
  approx = (trials > 100)
)

qmatching(
  p,
  size,
  trials = 1,
  prob = 0,
  lower.tail = TRUE,
  log.p = FALSE,
  approx = (trials > 100)
)

rmatching(n, size, trials = 1, prob = 0)

Arguments

x, q

A vector of numeric values to be used as arguments for the mass function

size

The size parameter for the generalised matching distribution (number of objects to match)

trials

The trials parameter for the generalised matching distribution (number of times the matching game is repeated)

prob

The probability parameter for the generalised matching distribution (probability of known match)

log, log.p

A logical value specifying whether results should be returned as log-probabilities

approx

A logical value specifying whether to use the normal approximation to the distribution

lower.tail

A logical value specifying whether the input represents lower or upper tail probabilities

p

vector of probabilities

n

number of observations

Value

dmatching gives the density, pmatching gives the distribution function, qmatching gives the quantile function and rmatching generates random deviates.

References

O'Neill, B. (2021) A generalised matching distribution for the problem of coincidences.

Examples

1
2
3
4
5
6
7
8
9
x <- rmatching(1000, 5)
tabulate(x)
# No Fours!
# This is actually one of the key properties of the matching distribution.  
# With size parameter n the distribution has support 0,1,2,...,n-2,n (i.e., it 
# cannot give outcome n-1). The reason for this is that in a permutation it 
# is impossible to give n-1 matches. 
# If there are n-1 matches then the last object in the permutation must also be a match.
dmatching(0:5, 5)

stat.extend documentation built on Nov. 23, 2021, 5:06 p.m.