dpch_fun {miniPCH} | R Documentation |
Survival Distributions with piece-wise Constant Hazards (function factories)
Description
Densitiy, distribution function, quantiles, random numbers, hazard function, cumulative hazard function and survival function of survival distributions with piece-wise constant hazards (picewise exponential distributions).
Those functions return functions of one parameter that can be evaluated to
give the density, distribution function, ... The parameters t
and lambda
are checked only once and not at every function evaluation.
Usage
dpch_fun(t, lambda)
ppch_fun(t, lambda)
qpch_fun(t, lambda)
rpch_fun(t, lambda, discrete = FALSE)
hpch_fun(t, lambda)
chpch_fun(t, lambda)
spch_fun(t, lambda)
pch_functions(t, lambda, discrete = FALSE)
Arguments
t |
vector of left interval borders |
lambda |
vector of hazards |
discrete |
round survival times to whole numbers in RNG |
Value
dpch_fun
gives the density.
ppch_fun
gives the distribution function
qpch_fun
gives the quantile function.
rpch_fun
gives a function to sample from the given distribution.
hpch_fun
gives the hazard function.
chpch_fun
gives the cumulative hazard function.
spch_fun
gives the survival function.
pch_functions
gives an object of class "miniPCH"
Functions
-
dpch_fun()
: density of survival distributions with piece-wise constant hazards -
ppch_fun()
: distribution function of survival distributions with piece-wise constant hazards -
qpch_fun()
: quantile function of survival distributions with piece-wise constant hazards -
rpch_fun()
: RNG function of survival distributions with piece-wise constant hazards -
hpch_fun()
: hazard function of survival distributions with piece-wise constant hazards -
chpch_fun()
: cumulative hazard function of survival distributions with piece-wise constant hazards -
spch_fun()
: survival function of survival distributions with piece-wise constant hazards
See Also
Examples
pch_density <- dpch_fun(c(0, 3), c(2, 0.1))
pch_density(1:10)
pch_distr <- ppch_fun(c(0, 3), c(2, 0.1))
pch_distr(1:10)
pch_quant <- qpch_fun(c(0, 3), c(2, 0.1))
pch_quant(seq(0,1, by=0.1))
rpch_fun_cont <- rpch_fun(c(0, 3), c(2, 0.1))
rpch_fun_discr <- rpch_fun(c(0, 3), c(2, 0.1), discrete=TRUE)
rpch_fun_cont(15)
rpch_fun_discr(15)
pch_haz <- hpch_fun(c(0, 3), c(2, 0.1))
pch_haz(1:10)
pch_cumhaz <- chpch_fun(c(0, 3), c(2, 0.1))
pch_cumhaz(1:10)
pch_surv <- spch_fun(c(0, 3), c(2, 0.1))
pch_surv(1:10)
my_pch <- pch_functions(c(0, 3), c(2, 0.1))#
my_pch$t
my_pch$r(15)
my_pch$ch(1:10)