hazard_fun: Hazard functions in 'maxlogL' framework

View source: R/hazard_fun.R

hazard_funR Documentation

Hazard functions in maxlogL framework

Description

[Experimental]

This function takes the name of a probability density/mass function as an argument and creates a hazard function.

Usage

hazard_fun(dist, support)

Arguments

dist

a length-one character vector with the name of density/mass function of interest.

support

a list with the following entries:

  • interval: a two dimensional atomic vector indicating the set of possible values of a random variable having the distribution specified in y_dist.

  • type: character indicating if distribution has a discrete or a continous random variable.

Value

A function with the folling input arguments:

x

vector of (non-negative) quantiles.

...

Arguments of the probability density/mass function.

Author(s)

Jaime Mosquera GutiƩrrez, jmosquerag@unal.edu.co

See Also

Other maxlogL: maxlogLreg(), maxlogL()

Examples

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)


#--------------------------------------------------------------------------------


EstimationTools documentation built on Dec. 10, 2022, 9:07 a.m.