View source: R/qprimarycensored.R
qprimarycensored | R Documentation |
This function computes the quantiles (delay values) that correspond to specified probabilities in the primary event censored distribution. For a given probability p, it computes the delay value q such that the cumulative probability up to q equals p in the primary event censored distribution. The distribution accounts for both the delay distribution and the primary event timing distribution.
qprimarycensored(
p,
pdist,
pwindow = 1,
D = Inf,
dprimary = stats::dunif,
dprimary_args = list(),
...
)
qpcens(
p,
pdist,
pwindow = 1,
D = Inf,
dprimary = stats::dunif,
dprimary_args = list(),
...
)
p |
Vector of probabilities between 0 and 1 for which to compute corresponding quantiles |
pdist |
Distribution function (CDF). The package can identify base R
distributions for potential analytical solutions. For non-base R functions,
users can apply |
pwindow |
Primary event window |
D |
Maximum delay (truncation point). If finite, the distribution is truncated at D. If set to Inf, no truncation is applied. Defaults to Inf. |
dprimary |
Function to generate the probability density function
(PDF) of primary event times. This function should take a value |
dprimary_args |
List of additional arguments to be passed to
dprimary. For example, when using |
... |
Additional arguments to be passed to pdist |
For each probability, the function finds the delay value where that proportion of events have occurred by that time in the primary event censored distribution. This is done by inverting the cumulative distribution function.
The function creates a primarycensored
object using new_pcens()
and then
computes the quantiles using pcens_quantile()
. This approach allows for
analytical solutions when available, falling back to numerical methods when
necessary.
For example, if p = 0.5, the function returns the median delay - the value where 50% of censored events occur by this time and 50% occur after.
See methods(pcens_quantile)
for which combinations have analytical
solutions implemented.
Vector of delay values (quantiles) corresponding to the input probabilities
new_pcens()
and pcens_quantile()
Primary event censored distribution functions
dprimarycensored()
,
pprimarycensored()
,
rprimarycensored()
# Compute delays where 25%, 50%, and 75% of events occur by (quartiles)
# Using lognormal delays with uniform primary events
qprimarycensored(c(0.25, 0.5, 0.75), plnorm, meanlog = 0, sdlog = 1)
# Same quartiles but with exponential growth in primary events
qprimarycensored(
c(0.25, 0.5, 0.75), plnorm,
dprimary = dexpgrowth,
dprimary_args = list(r = 0.2), meanlog = 0, sdlog = 1
)
# Same quartiles but with truncation at 10
qprimarycensored(
c(0.25, 0.5, 0.75), plnorm,
dprimary = dexpgrowth,
dprimary_args = list(r = 0.2), meanlog = 0, sdlog = 1, D = 10
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.