Access a distribution's hazard function.

eval_hazard(object, at)

get_hazard(object)

enframe_hazard(object, at, arg_name = ".arg", fn_name = ".hazard")

Arguments

object

Distribution object.

at

Vector of values to evaluate the cdf at.

arg_name

Name of the column containing the function arguments, in the output data frame of enframe_.

fn_name

Name of the column containing the function evaluations, in the output data frame of enframe_.

Value

A vector of the evaluated hazard, in the case of eval_; a data frame with both the argument and function evaluations, in the case of enframe_; or a vectorized function representing the hazard, in the case of get_.

See also

Other distributional representations: eval_cdf(), eval_density(), eval_pmf(), eval_quantile(), eval_survival(), get_chf()

Examples

d <- dst_unif(0, 4) eval_hazard(d, at = 0:4)
#> [1] 0.2500000 0.3333333 0.5000000 1.0000000 Inf
enframe_hazard(d, at = 0:4)
#> .arg .hazard #> 1 0 0.2500000 #> 2 1 0.3333333 #> 3 2 0.5000000 #> 4 3 1.0000000 #> 5 4 Inf
hazard <- get_hazard(d) hazard(0:4)
#> [1] 0.2500000 0.3333333 0.5000000 1.0000000 Inf