Title: | Functions for Conditional Hypergeometric Distributions |
---|---|
Description: | An implementation of the probability mass function, cumulative density function, quantile function, random number generator, maximum likelihood estimator, and p-value generator from a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size. |
Authors: | William Nickols |
Maintainer: | William Nickols <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.2 |
Built: | 2025-02-20 04:44:29 UTC |
Source: | https://github.com/willnickols/chyper |
Calculates the PMF of a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size.
dchyper(k, s, n, m, verbose = T)
dchyper(k, s, n, m, verbose = T)
k |
an integer or vector of integers representing the overlap size |
s |
an integer representing the size of the intersecting population |
n |
a vector of integers representing the sizes of each non-intersecting population |
m |
a vector of integers representing the sample sizes |
verbose |
T/F should intermediate messages be printed? |
The probability of sampling k
of the same items in all samples
dchyper(c(3,5), 10, c(12,13,14), c(7,8,9))
dchyper(c(3,5), 10, c(12,13,14), c(7,8,9))
Calculates the mean of a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size.
meanchyper(s, n, m)
meanchyper(s, n, m)
s |
an integer representing the size of the intersecting population |
n |
a vector of integers representing the sizes of each non-intersecting population |
m |
a vector of integers representing the sample sizes |
The mean of the conditional hypergeometric distribution specified
meanchyper(10, c(12,13,14), c(7,8,9))
meanchyper(10, c(12,13,14), c(7,8,9))
Calculates the MLE of a sample size in a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size.
mleM(population, k, s, n, m, verbose = T)
mleM(population, k, s, n, m, verbose = T)
population |
the index of the unknown sample size |
k |
the observed overlaps |
s |
an integer representing the size of the intersecting population |
n |
a vector of integers representing the sizes of each non-intersecting population |
m |
a vector of integers representing the sample sizes where the value of the unknown sample size should be any integer as a placeholder |
verbose |
T/F should intermediate messages be printed? |
The maximum likelihood estimator of the unknown sample size
mleM(1, c(0,0,1,1,0,2,0), 8, c(12,13,14), c(0,8,9))
mleM(1, c(0,0,1,1,0,2,0), 8, c(12,13,14), c(0,8,9))
Calculates the MLE of a unique population size in a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size.
mleN(population, k, s, n, m, verbose = T)
mleN(population, k, s, n, m, verbose = T)
population |
the index of the unique population to estimate |
k |
the observed overlaps |
s |
an integer representing the size of the intersecting population |
n |
a vector of integers representing the sizes of each non-intersecting population where the value of the unknown population size should be any integer as a placeholder |
m |
a vector of integers representing the sample sizes |
verbose |
T/F should intermediate messages be printed? |
The maximum likelihood estimator of the unknown unique population size
mleN(1, c(0,0,1,1,0,2,0), 8, c(0,13,14), c(7,8,9))
mleN(1, c(0,0,1,1,0,2,0), 8, c(0,13,14), c(7,8,9))
Calculates the MLE of the overlap size in a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size.
mleS(k, n, m, verbose = T)
mleS(k, n, m, verbose = T)
k |
the observed overlaps |
n |
a vector of integers representing the sizes of each non-intersecting population |
m |
a vector of integers representing the sample sizes |
verbose |
T/F should intermediate messages be printed? |
The maximum likelihood estimator of the intersecting population size
mleS(c(0,0,1,1,0,2,0), c(12,13,14), c(7,8,9))
mleS(c(0,0,1,1,0,2,0), c(12,13,14), c(7,8,9))
Calculates the MOM estimator of a sample size in a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size.
momM(population, k, s, n, m)
momM(population, k, s, n, m)
population |
the index of the unknown sample size |
k |
the observed overlaps |
s |
an integer representing the size of the intersecting population |
n |
a vector of integers representing the sizes of each non-intersecting population |
m |
a vector of integers representing the sample sizes where the value of the unknown sample size should be any integer as a placeholder |
The method of moments estimator of the unknown sample size
momM(1, c(0,0,1,1,0,2,0), 8, c(12,13,14), c(0,8,9))
momM(1, c(0,0,1,1,0,2,0), 8, c(12,13,14), c(0,8,9))
Calculates the MOM estimator of a unique population size in a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size.
momN(population, k, s, n, m)
momN(population, k, s, n, m)
population |
the index of the unique population to estimate |
k |
the observed overlaps |
s |
an integer representing the size of the intersecting population |
n |
a vector of integers representing the sizes of each non-intersecting population where the value of the unknown population size should be any integer as a placeholder |
m |
a vector of integers representing the sample sizes |
The method of moments estimator of the unknown unique population size
momN(1, c(0,0,1,1,0,2,0), 8, c(0,13,14), c(7,8,9))
momN(1, c(0,0,1,1,0,2,0), 8, c(0,13,14), c(7,8,9))
Calculates the CDF of a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size.
pchyper(k, s, n, m, verbose = T)
pchyper(k, s, n, m, verbose = T)
k |
an integer or vector of integers representing the overlap size |
s |
an integer representing the size of the intersecting population |
n |
a vector of integers representing the sizes of each non-intersecting population |
m |
a vector of integers representing the sample sizes |
verbose |
T/F should intermediate messages be printed? |
The probability of sampling k
or less of the same items in all samples
pchyper(c(3,5), 10, c(12,13,14), c(7,8,9))
pchyper(c(3,5), 10, c(12,13,14), c(7,8,9))
Calculates p-values from a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size.
pvalchyper(k, s, n, m, tail = "upper", verbose = T)
pvalchyper(k, s, n, m, tail = "upper", verbose = T)
k |
an integer or vector of integers representing the overlap size |
s |
an integer representing the size of the intersecting population |
n |
a vector of integers representing the sizes of each non-intersecting population |
m |
a vector of integers representing the sample sizes |
tail |
whether the p-value should be from the upper or lower tail (options: "upper", "lower") |
verbose |
T/F should intermediate messages be printed? |
The probability of getting the k or more (or less if tail="lower") overlaps by chance from the conditional hypergeometric distribution specified by the parameters
pvalchyper(c(1,2), 8, c(12,13,14), c(7,8,9), "upper")
pvalchyper(c(1,2), 8, c(12,13,14), c(7,8,9), "upper")
Calculates the quantile function of a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size.
qchyper(p, s, n, m, verbose = T)
qchyper(p, s, n, m, verbose = T)
p |
the desired quantile or quantiles |
s |
an integer representing the size of the intersecting population |
n |
a vector of integers representing the sizes of each non-intersecting population |
m |
a vector of integers representing the sample sizes |
verbose |
T/F should intermediate messages be printed? |
The minimum integer (or integers for a vector input) such that the input probability is less than or equal to the probability of sampling that many of the same items in all samples.
qchyper(c(0,0.9,1), 10, c(12,13,14), c(7,8,9))
qchyper(c(0,0.9,1), 10, c(12,13,14), c(7,8,9))
Generates random numbers from a conditional hypergeometric distribution: the distribution of how many items are in the overlap of all samples when samples of arbitrary size are each taken without replacement from populations of arbitrary size.
rchyper(size, s, n, m, verbose = T)
rchyper(size, s, n, m, verbose = T)
size |
the number of random numbers to generate |
s |
an integer representing the size of the intersecting population |
n |
a vector of integers representing the sizes of each non-intersecting population |
m |
a vector of integers representing the sample sizes |
verbose |
T/F should intermediate messages be printed? |
A vector of random numbers generated from the PMF of the conditional hypergeometric distribution specified by the parameters
rchyper(100, 10, c(12,13,14), c(7,8,9))
rchyper(100, 10, c(12,13,14), c(7,8,9))