cum_hazard_fun | R Documentation |
This function takes a maxlogL
hazard function and computes the
cumulative hazard function.
cum_hazard_fun(
distr,
support = NULL,
method = c("log_sf", "integration"),
routine = NULL
)
distr |
a length-one character vector with the name of density/mass function of interest. |
support |
a list with the following entries:
|
method |
a character or function; if |
routine |
a character specifying the integration routine.
|
A function with the following input arguments:
x |
vector of (non-negative) quantiles. |
... |
Arguments of the probability density/mass function. |
Jaime Mosquera GutiƩrrez, jmosquerag@unal.edu.co
Other distributions utilities:
expected_value()
,
hazard_fun()
library(EstimationTools)
#----------------------------------------------------------------------------
# Example 1: Cumulative hazard function of the Weibull distribution.
support <- list(interval=c(0, Inf), type='continuous')
# Cumuative hazard function in the 'maxlogL' framework
Hweibull1 <- cum_hazard_fun(
distr = 'dweibull',
support = support,
method = "integration"
)
Hweibull2 <- cum_hazard_fun(
distr = 'dweibull',
method = "log_sf"
)
# Compute cumulative hazard function from scratch
# Recall h(x) = shape/scale * (x/scale)^(shape - 1), then
# H(x) = (x/scale)^shape
Hweibull3 <- function(x, scale, shape){
(x/scale)^shape
}
# Comparison
Hweibull1(0.2, shape = 2, scale = 1) # using H(t) = -log(S(t))
Hweibull2(0.2, shape = 2, scale = 1) # integrating h(t)
Hweibull3(0.2, shape = 2, scale = 1) # raw version
#----------------------------------------------------------------------------
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.