Evaluating the hazard function when the CDF is close to 1? I need to evaluate a hazard function $h(t;\theta) = \dfrac{f(t;\theta)}{1-F(t;\theta)}$, where $f$ and $F$ are a pdf and a cdf, respectively, at many values of $t$ (and for several values of the parameter $\theta$). In some cases, when I evaluate $F(t;\theta)$, it returns the value $1$ for some values of $t$, making $h$ infinite.
For example, in R pweibull(100,1,1) returns 1.
Is there any trick to avoid this problem?


*

*I wasn't sure if I should ask this question on stackoverflow instead, but since the question is related to a function that is widely used in statistics, I thought crossvalidated was a better place as some people may know of a "classical" solution.

 A: If the matter is numerical stability, you could look at the log of the hazard function:
$$log(h(t; \theta)) = log(f(t;\theta)) - log(1-F(t;\theta))$$
You could use the log / log.p = TRUE flag in R for log values and the lower.tail flag for obtaining $log(1 - F(t;\theta))$ values:
dweibull(100,1,1, log = T) # -100
pweibull(100, 1, 1, log.p = TRUE, lower.tail = FALSE) # -100

Which gives you an estimate: $h(t;\theta) = exp(-100 + 100) = 1$

Edit: By the way, when you have a $Weibull(1, 1)$ distribution, I believe that this is an $Exponential(1)$, so it has a constant hazard function.
A: For a survival curve based on a parametric distribution, often the hazard is an explicit function of the parameters. For example, this link provides several hazard functions for different distribtuons. So when we know the values of parameters and want to calculate the hazard, as asked in this question, the best way is to use the hazard function directly, instead of going through CDF and PDF. 
For example, the hazard function is $h(x)=γx^{(γ−1)}$ for the standard Weibull distribution.
