View source: R/pcens_quantile.R
| pcens_quantile.default | R Documentation |
This method inverts the primary event censored CDF by root-finding via
stats::uniroot() with extendInt = "upX". The censored CDF is monotone
in q, so stats::uniroot() extends its starting bracket outward as
needed and handles infinite L or D without special casing.
## Default S3 method:
pcens_quantile(
object,
p,
pwindow,
L = -Inf,
D = Inf,
use_numeric = FALSE,
init = 5,
tol = 1e-08,
max_iter = 10000,
...
)
object |
A |
p |
A vector of probabilities at which to compute the quantiles. |
pwindow |
Primary event window |
L |
Minimum delay (lower truncation point). Defaults to |
D |
Maximum delay (upper truncation point). If finite, the distribution is truncated at D. If set to Inf, no upper truncation is applied. Defaults to Inf. |
use_numeric |
Logical; if TRUE forces the use of numeric inversion even if an analytical solution is available (not yet implemented). |
init |
Half-width of the initial search interval used when one or
both truncation bounds are infinite. The starting interval is taken as
|
tol |
Numeric tolerance passed to |
max_iter |
Maximum number of |
... |
Additional arguments passed to underlying functions. |
A numeric vector containing the computed primary event censored quantiles.
Low level primary event censored distribution objects and methods
new_pcens(),
pcens_cdf(),
pcens_cdf.default(),
pcens_cdf.pcens_pgamma_dunif(),
pcens_cdf.pcens_plnorm_dunif(),
pcens_cdf.pcens_pweibull_dunif(),
pcens_quantile()
# Create a primarycensored object with gamma delay and uniform primary
pcens_obj <- new_pcens(
pdist = pgamma,
dprimary = dunif,
dprimary_args = list(min = 0, max = 1),
shape = 3,
scale = 2
)
# Compute quantile for a single probability
pcens_quantile(pcens_obj, p = 0.8, pwindow = 1)
# Compute quantiles for multiple probabilities
pcens_quantile(pcens_obj, p = c(0.25, 0.5, 0.75), pwindow = 1)
# Compute quantiles for multiple probabilities with truncation
pcens_quantile(pcens_obj, p = c(0.25, 0.5, 0.75), pwindow = 1, D = 10)
# Compute quantiles with left truncation
pcens_quantile(pcens_obj, p = c(0.25, 0.5, 0.75), pwindow = 1, L = 1, D = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.