Skip to contents

ProductVariance: Var(XY) = Var(X) Var(Y) + (EX)^2 Var(Y) + (EY)^2 Var(X) for independent factors. WeibullMoments: mean Gamma(1 + 1/gamma) / lam^(1/gamma) and variance of T = X^(1/gamma), X ~ Expo(lam). FoldedNormal: CDF, density, mean and variance of |X|, X ~ N(mu, sigma^2). Chisq1Cdf: 2 Phi(sqrt(x)) - 1. HarmonicMeanEvidence: Newton-Raftery log m = log S - logsumexp(-l_s). CrpsCdf: int (F(z) - 1(z >= y))^2 dz by exp-sinh tails and tanh-sinh pieces between y and the breaks. MaxEntropyDiscrete: p_i = q_i exp(sum_k lambda_k g_k(x_i)) / Z by Newton steps on the dual. BvLogisticSimulate: Shi's mixture method for the bivariate logistic extreme-value law (the algorithm of evd::rbvevd) on Philox streams 0-3, with GEV margins. DdmDrift: Gama et al. (2004) drift detection (0-based indices). KingKinship: KING robust (between-family) or within-family kinship.

Usage

ProductVariance(mean_x, var_x, mean_y, var_y)

WeibullMoments(lam, gamma)

FoldedNormal(y, mu = 0, sigma = 1)

Chisq1Cdf(x)

HarmonicMeanEvidence(log_lik)

CrpsCdf(cdf, y, breaks = numeric(0), h = 1/64)

MaxEntropyDiscrete(
  support_values,
  targets,
  prior = NULL,
  tol = 1e-12,
  max_iter = 200
)

BvLogisticSimulate(
  n,
  alpha,
  loc = c(0, 0),
  scale = c(1, 1),
  shape = c(0, 0),
  seed = 0
)

DdmDrift(errors, min_instances = 30, warning_level = 2, drift_level = 3)

KingKinship(genotypes, method = "robust")

Arguments

mean_x, var_x, mean_y, var_y

Means and variances of the two factors.

lam, gamma

Weibull rate and shape (Blitzstein-Hwang parameterisation).

y

Evaluation points, or the observation for CrpsCdf.

mu, sigma

Normal mean and standard deviation.

x

Values.

log_lik

Log-likelihoods at posterior draws.

cdf

A CDF function.

breaks

Points where the CDF is not smooth.

h

Double-exponential step.

support_values

Matrix (constraints by support points) of g_k(x_i).

targets

Target moments.

prior

Prior probabilities, or NULL for uniform.

tol, max_iter

Newton tolerance and iterations.

n

Number of draws.

alpha

Logistic dependence (0, 1].

loc, scale, shape

GEV margin parameters (length 2).

seed

Philox seed.

errors

0/1 error stream.

min_instances, warning_level, drift_level

DDM settings.

genotypes

Matrix individuals by SNPs of minor-allele counts (NA missing).

method

"robust" or "within".

Value

A number, vector or list.

References

Blitzstein, J. K. and Hwang, J. (2019). Introduction to Probability, 2nd ed. Leone, F. C. et al. (1961). Technometrics 3, 543-550. Newton, M. A. and Raftery, A. E. (1994). JRSS B 56, 3-48. Matheson, J. E. and Winkler, R. L. (1976). Management Science 22, 1087-1096. Jaynes, E. T. (1957). Physical Review 106, 620-630. Shi, D. (1995). Biometrika 82, 644-649. Stephenson, A. (2003). Extremes 6, 49-59. Gama, J. et al. (2004). SBIA 2004, 286-295. Manichaikul, A. et al. (2010). Bioinformatics 26, 2867-2873.

Examples

ProductVariance(1, 2, 3, 4)
#> [1] 30
CrpsCdf(pnorm, 0.3)
#> [1] 0.2693329
MaxEntropyDiscrete(rbind(1:6), 4.5)$p
#> [1] 0.05435317 0.07877155 0.11415998 0.16544680 0.23977444 0.34749407