Marginal density, marginal distribution function, marginal quantile function and random generation for weight functions.

mdone.sided(x, alpha = NULL, alpha1 = NULL, alpha2 = NULL, log = FALSE)

mdtwo.sided(x, alpha, log = FALSE)

mdone.sided_fixed(x, omega, log = FALSE)

mdtwo.sided_fixed(x, omega, log = FALSE)

rone.sided(n, alpha = NULL, alpha1 = NULL, alpha2 = NULL)

rtwo.sided(n, alpha)

rone.sided_fixed(n, omega)

rtwo.sided_fixed(n, omega)

mpone.sided(
  q,
  alpha = NULL,
  alpha1 = NULL,
  alpha2 = NULL,
  lower.tail = TRUE,
  log.p = FALSE
)

mptwo.sided(q, alpha, lower.tail = TRUE, log.p = FALSE)

mpone.sided_fixed(q, omega, lower.tail = TRUE, log.p = FALSE)

mptwo.sided_fixed(q, omega, lower.tail = TRUE, log.p = FALSE)

mqone.sided(
  p,
  alpha = NULL,
  alpha1 = NULL,
  alpha2 = NULL,
  lower.tail = TRUE,
  log.p = FALSE
)

mqtwo.sided(p, alpha, lower.tail = TRUE, log.p = FALSE)

mqone.sided_fixed(p, omega, lower.tail = TRUE, log.p = FALSE)

mqtwo.sided_fixed(p, omega, lower.tail = TRUE, log.p = FALSE)

Arguments

x, q

numeric vector of quantiles; the parameter arguments (alpha, omega) may be matrices with one row per quantile.

alpha

vector or matrix with concentration parameters for the Dirichlet distribution for a monotonic one.sided or a two.sided weight function.

alpha1

vector or matrix with concentration parameters for the Dirichlet distribution for the expected direction of non-monotonic one.sided of weight function.

alpha2

vector or matrix with concentration parameters for the Dirichlet distribution for the unexpected direction of non-monotonic one.sided of weight function.

log, log.p

logical; if TRUE, probabilities p are given as log(p).

omega

vector or matrix of fixed non-negative relative weights for a one.sided or a two.sided weight function. The first/reference weight must be exactly 1.

n

number of observations.

lower.tail

logical; if TRUE (default), probabilities are \(P[X \le x]\), otherwise, \(P[X > x]\).

p

vector of probabilities.

Value

mdone.sided, mdtwo.sided, mdone.sided_fixed, and mdtwo.sided_fixed give the marginal density, mpone.sided, mptwo.sided, mpone.sided_fixed, and mptwo.sided_fixed give the marginal distribution function, mqone.sided, mqtwo.sided, mqone.sided_fixed, and mqtwo.sided_fixed give the marginal quantile function, and rone.sided, rtwo.sided, rone.sided_fixed, and rtwo.sided_fixed generate random deviates.

Details

The marginal density, distribution function, and quantile function are implemented for the monotonic parameterization (alpha) and for fixed weights (omega); the non-monotonic parameterization (alpha1, alpha2) supports random generation only. The same marginals of a prior_weightfunction() prior are available through mpdf(), mcdf(), mquant(), and rng().

The marginals of the monotonic parameterization are Beta distributions with the cumulative sums of alpha as shapes. Finite alpha whose cumulative sums exceed the largest double signal an error of class BayesTools_weightfunction_beta_shape_unavailable (parent BayesTools_weightfunction_unavailable) from the density, distribution, and quantile functions, and from mpdf(), mcdf(), and mquant() of a cumulative prior_weightfunction(). Degenerate Dirichlet draws of the random generation signal BayesTools_dirichlet_rng_unavailable.

Examples

# draw samples from a two-sided weight function
rtwo.sided(10, alpha = c(1, 1))
#>       [,1]       [,2]
#>  [1,]    1 0.38158741
#>  [2,]    1 0.65898459
#>  [3,]    1 0.26455932
#>  [4,]    1 0.57377765
#>  [5,]    1 0.94413481
#>  [6,]    1 0.58500214
#>  [7,]    1 0.08396359
#>  [8,]    1 0.91470460
#>  [9,]    1 0.62069994
#> [10,]    1 0.81284209

# draw samples from a monotone one-sided weight function
rone.sided(10, alpha = c(1, 1, 1))
#>       [,1]      [,2]      [,3]
#>  [1,]    1 0.9608803 0.8769134
#>  [2,]    1 0.9759831 0.6407324
#>  [3,]    1 0.2634984 0.2171226
#>  [4,]    1 0.7707671 0.1587757
#>  [5,]    1 0.5712306 0.4731679
#>  [6,]    1 0.4843504 0.4602232
#>  [7,]    1 0.8653360 0.8201653
#>  [8,]    1 0.8242785 0.1804111
#>  [9,]    1 0.6590175 0.5818302
#> [10,]    1 0.4794643 0.1021826

# draw samples from a non-monotone one-sided weight function
rone.sided(10, alpha1 = c(1, 1), alpha2 = c(1, 1))
#>       [,1]       [,2]      [,3]
#>  [1,]    1 0.90100116 0.9731780
#>  [2,]    1 0.10270708 0.4825053
#>  [3,]    1 0.82844974 0.8380465
#>  [4,]    1 0.29140310 0.4802061
#>  [5,]    1 0.72345174 0.9878073
#>  [6,]    1 0.03404128 0.8208037
#>  [7,]    1 0.90546006 0.9595856
#>  [8,]    1 0.89529970 0.9757184
#>  [9,]    1 0.21524578 0.9436983
#> [10,]    1 0.91385254 0.9820721