qpbox: Query the probabilistic space of a pbox object.
Description
This function queries the probabilistic space of a pbox object to calculate probabilities
associated with specific marginal or conditional distributions. It supports conditional
probability calculations and can optionally estimate confidence intervals through bootstrapping.
This method processes the pbox object to compute probabilities based on the specified marginal
and conditional parameters. It handles both simple probability calculations and complex queries involving
joint and conditional distributions, with an option for bootstrap confidence interval estimation.
Usage
qpbox(
pbx,
mj = "character",
co = "character",
lower.tail = TRUE,
fixed = FALSE,
CI = FALSE,
iter = 1000
)
# S4 method for pbox
qpbox(
pbx,
mj = "character",
co = "character",
lower.tail = TRUE,
fixed = FALSE,
CI = FALSE,
iter = 1000
)
Value
Estimated probabilities as a numeric value or a named vector including confidence intervals if requested.
Arguments
pbx
An object of class pbox from which to query the probabilistic space.
mj
A character string specifying the marginal and or joint distribution of the variable.
It must specify the variable and the value in the format 'Var:Val'.
co
A character string specifying the marginal and conditional distribution of the variable.
It must specify the variable and the value in the format 'Var:Val'.
lower.tail
Logical; if TRUE (default), probabilities are calculated for the area to the right of the specified value.
fixed
Logical; if TRUE, calculates conditional probabilities with conditions treated as fixed.
CI
Logical; if TRUE, calculates bootstrap confidence intervals.
iter
Integer; the number of replications for the confidence interval calculation. Default is 1000.
data("SEAex")
pbx <- set_pbox(SEAex)
# Get marginal distribution qpbox(pbx, mj="Malaysia:33")
# Get conditional distribution qpbox(pbx, mj="Malaysia:33 & Vietnam:31", co="avgRegion:26")