# In teachingApps: Apps for Teaching Statistics, R Programming, and Shiny App Development

### Computing Values For the Cumulative Hazard Function in R

• No predefined R function exists for $H(t)$, but we can take advantage of the fact that $$H(t)=-\ln[1-F(t)]$$

• For $\;T \sim Weibull(\beta,\theta)$
$H(t)=$ -log(1 - pweibull(q = quantile, shape = shape param, scale = scale param))

• For $\;T \sim Exponential(\lambda)$
$H(t)=$ -log(1 - pexp(q = quantile, rate = rate parameter))

• For $\;T \sim Normal(\mu,\sigma)$
$H(t)=$ -log(1 - pnorm(q = quantile, mean = mean, sd = standard deviation))

• For $\;T \sim Lognormal(\mu,\sigma)$
$H(t)=$ -log(1 - plnorm(q = quantile, meanlog = log(mean), sdlog = log(stdev)))

• For $T \sim Gamma(\kappa,\beta)$
$H(t)=$ -log(1-pgamma(q = quantile, shape = shape param, scale = scale param))

## Try the teachingApps package in your browser

Any scripts or data that you put into this service are public.

teachingApps documentation built on July 1, 2020, 5:58 p.m.