library(EstimationTools)
#--------------------------------------------------------------------------------
# Example 1: Hazard function of Weibull distribution.
hweibull1 <- hazard_fun('dweibull', list(interval=c(0, Inf), type='continuous'))
hweibull2 <- function(x){
ans <- dweibull(x, shape = 2, scale = 1)/
pweibull(x, shape = 2, scale = 1, lower.tail = FALSE)
ans
}
hweibull1(0.2, shape = 2, scale = 1)
hweibull2(0.2)
#--------------------------------------------------------------------------------
Run the code above in your browser using DataLab