S3 class for primary event censored distribution computation
Usage
new_pcens(
pdist,
dprimary,
dprimary_args,
pdist_name = lifecycle::deprecated(),
dprimary_name = lifecycle::deprecated(),
...
)
Arguments
- pdist
Distribution function (CDF). The package can identify base R distributions for potential analytical solutions. For non-base R functions, users can apply
add_name_attribute()
to yield properly tagged functions if they wish to leverage the analytical solutions.- dprimary
Function to generate the probability density function (PDF) of primary event times. This function should take a value
x
and apwindow
parameter, and return a probability density. It should be normalized to integrate to 1 over [0, pwindow]. Defaults to a uniform distribution over [0, pwindow]. Users can provide custom functions or use helper functions likedexpgrowth
for an exponential growth distribution. Seepcd_primary_distributions()
for examples. The package can identify base R distributions for potential analytical solutions. For non-base R functions, users can applyadd_name_attribute()
to yield properly tagged functions if they wish to leverage analytical solutions.- dprimary_args
List of additional arguments to be passed to dprimary. For example, when using
dexpgrowth
, you would passlist(min = 0, max = pwindow, r = 0.2)
to set the minimum, maximum, and rate parameters- pdist_name
this argument will be ignored in future versions; use
add_name_attribute()
onpdist
instead- dprimary_name
this argument will be ignored in future versions; use
add_name_attribute()
ondprimary
instead- ...
Additional arguments to be passed to pdist
Value
An object of class pcens_{pdist_name}_{dprimary_name}
. This
contains the primary event distribution, the delay distribution, the
delay distribution arguments, and any additional arguments. It can be
used with the pcens_cdf()
function to compute the primary event censored
cdf.
See also
Low level primary event censored distribution objects and methods
pcens_cdf()
,
pcens_cdf.default()
,
pcens_cdf.pcens_pgamma_dunif()
,
pcens_cdf.pcens_plnorm_dunif()
,
pcens_cdf.pcens_pweibull_dunif()
,
pcens_quantile()
,
pcens_quantile.default()
Examples
new_pcens(
pdist = pgamma, dprimary = dunif, dprimary_args = list(min = 0, max = 1),
shape = 1, scale = 1
)
#> $pdist
#> function (q, shape, rate = 1, scale = 1/rate, lower.tail = TRUE,
#> log.p = FALSE)
#> {
#> if (!missing(rate) && !missing(scale)) {
#> if (abs(rate * scale - 1) < 1e-15)
#> warning("specify 'rate' or 'scale' but not both")
#> else stop("specify 'rate' or 'scale' but not both")
#> }
#> .Call(C_pgamma, q, shape, scale, lower.tail, log.p)
#> }
#> <bytecode: 0x564c8e3073c8>
#> <environment: namespace:stats>
#>
#> $dprimary
#> function (x, min = 0, max = 1, log = FALSE)
#> .Call(C_dunif, x, min, max, log)
#> <bytecode: 0x564c85aa93a0>
#> <environment: namespace:stats>
#>
#> $dprimary_args
#> $dprimary_args$min
#> [1] 0
#>
#> $dprimary_args$max
#> [1] 1
#>
#>
#> $args
#> $args$shape
#> [1] 1
#>
#> $args$scale
#> [1] 1
#>
#>
#> attr(,"class")
#> [1] "pcens_pgamma_dunif"