Hot answers tagged

21

Apparently, basehaz() actually computes a cumulative hazard rate, rather than the hazard rate itself. The formula is as follows: $$ \hat{H}_0(t) = \sum_{y_{(l)} \leq t} \hat{h}_0(y_{(l)}), $$ with $$ \hat{h}_0(y_{(l)}) = \frac{d_{(l)}}{\sum_{j \in R(y_{(l)})} \exp(\mathbf{x}^{\prime}_j \mathbf{\beta})} $$ where $y_{(1)} < y_{(2)} < \cdots$ denote the ...


21

Brief and general answer: With Poisson regression, the response variable of interest is a count (or possibly a rate). With Cox regression (or alternative modelling strategies from survival analysis), the response variable is the time that has elapsed between some origin and an event of interest. In particular, survival analysis techniques are designed to ...


16

The function in the R survival package to get the baseline hazard rate is basehaz. Then you need to multiply it for the various $e^{\beta}$ to get the specific hazard rate given the coefficients you have found. A simple example may help: library(survival) #survival analysis library(eha) #used for data data(oldmort) #create the data # Create surv data ...


16

As some of the information you provided states, the two are not the same. I like better the terminology of conditional (on covariates) and unconditional (marginal) estimates. There is a very subtle language problem that clouds the issue greatly. Analysts who tend to love "population average effects" have a dangerous tendency to try to estimate such ...


14

Your intuition is correct. The following relationship between survival functions holds: $$ S_1(t)=S_0(t)^r $$ where $r$ is the hazard ratio (see, e.g. the Wikipedia article Hazard ratio). From this we may show that your statement implies an exponential survival function. Let us denote the medians by $M_r$, $M_1$ for two variables with hazard ratio $r$. Your ...


13

The function basehaz (from the previous answer) provides the cumulative hazard, not the hazard function (the rate). I believe that question was about the hazard function. Estimating the hazard function would require specification of the type of smoothing (like in density estimation). The Muhaz R package can do this for one sample data. I am not aware of a ...


13

If you have not assumed linearity for the continuous variables, or if linearity truly holds, then a next logical step is to assess proportionality of hazards using smoothed scaled Schoenfeld residual plots as implemented in the R survival package's cox.zph function. These plots show the estimated regression coefficient for a binary or continuous variable as ...


13

Consider that there are shapes of pdf that have a mode, but at which the derivative of the pdf is not zero (the Laplace being an obvious example). There are also cases where there's no mode in the domain of the variable (examples below). That is, we can't say as a general statement "the mode can be obtained by taking the derivative of $g(x)$ and setting ...


11

Assuming proportional hazards (as in a Cox model) and the hazard ratio for a 1 mg increase in nicotine smoked a day is 1.02, then this tells you that persons smoking 11 mgs were 1.02 as likely to die in the monitored time period than persons smoking 10 mgs. The same applies to 12 vs 11 mgs etc. If the units of your continuous covariable are too small for ...


11

an odds ratio of 2 means that the event is 2 time more probable given a one-unit increase in the predictor It means the odds would double, which is not the same as the probability doubling. In Cox regression, a hazard ratio of 2 means the event will occur twice as often at each time point given a one-unit increase in the predictor. Aside a bit of ...


11

Let $X$ denote the time of death (or time of failure if you prefer a less morbid description). Suppose that $X$ is a continuous random variable whose density function $f(t)$ is nonzero only on $(0,\infty)$. Now, notice that it must be the case that $f(t)$ decays away to $0$ as $t \to \infty$ because if $f(t)$ does not decay away as stated, then $\...


10

The log-rank test is valid whatever the true situation with the hazards is. You are correct that only its power is affected. So if it rejects, then the hazards are not equal. If it does not reject, then you have to worry about the proportionality of hazards and power. The principled approach would be trying to estimate the difference/ratio of the two ...


10

A Poisson process is a model for a stream of "random" arrivals and has the properties that there can be at most one arrival at any instant $t$ the number of arrivals in any interval $(t_1,t_2]$ is a Poisson random variable which is here denoted as $\mathbb N(t_1,t_2]$ For $t_1 < t_2 \leq t_3 < t_4 \leq t_5 < t_6 < \cdots \leq t_{2n-1} < t_{...


10

Imagine that you are interested in the incidence of (first) marriage for men. To look at the incidence of marriage at age 20, say, you would select a sample of people who are not married at that age and see if they get married within the next year (before they turn 21). The you could get a rough estimate for $$ P(\mathrm{marry\,\, before\,\, 21}| \mathrm{...


9

The Book "An Introduction to Survival Analysis Using Stata" (2nd Edition) by Mario Cleves has a good chapter on that topic. You can find the chapter on google books, p. 13-15. But I would advise on reading the whole chapter 2. Here is the short form: "it measures the total amount of risk that has been accumulated up to time t" (p. 8) count data ...


9

This kind of wild fluctuation arises from floating point rounding errors in the calculations. The hazard function of a $\Gamma(a,1)$ distribution, with shape parameter $a$ and scale parameter $1$, equals $$H(x; a) = \frac{x^{a-1}\exp(-x)}{\int_x^\infty t^{a-1} \exp(-t) dt }.$$ The maximum requested in the question is also the limiting value as $x\to\infty$...


8

I think your question could be further defined. The first distinction for churn models is between creating (1) a binary (or multi-class if there are multiple types of churn) model to estimate the probability of a customer churning within or by a certain future point (e.g. the next 3 months) (2) a survival type model creating an estimate of the risk of ...


8

The hazard is indeed a rate. It is the expected number of events a person can expect per time unit conditional on being at risk, i.e. not having died before. Say we are studying the time until you get the flu [influenza] , and we measured time in months and we got a hazard rate of .10, that is, a person is expected to get the flu .10 times per month assuming ...


8

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....


7

If the positive random variable $T$ denotes the time of failure of a system with hazard rate $\lambda(t)$, then it is straightforward to show that the cumulative probability distribution function of $T$ is given by $$F_T(t) = 1 - \exp\left(-\int_0^t \lambda(\tau)\,\mathrm d\tau\right), ~ t \geq 0.$$ Thus, if the hazard rate $\lambda(t)$ equals a constant $...


7

The argument of a conditional pdf cannot depend on the conditioning event in any way, shape or form. In $$f_{T\mid A}(t\mid A) = \lim_{\delta\to 0} \frac{P\{t < T \leq t+\delta\mid A\}}{\delta},$$ $A$ can be a fixed event such as $\{T>5\}$ but not something that depends on $t$ such as $\{T > t\}$. Another important reason why a hazard function $h(...


7

The term for it seems to be relatively recent but the notion is considerably older. Jeff Miller's Earliest Known Uses of Some of the Words of Mathematics discusses the use of the term 'hazard rate', and it looks like that's from the 50s and 60s. It reports that the term "death-hazard rate" occurs in D. J. Davis "An Analysis of Some Failure Data," Journal ...


6

Assume $K$ is the largest value of $k$ (i.e. the largest month/period observed in your data). Here is the hazard function with a fully discrete parametrization of time, and with a vector of parameters $\mathbf{B}$ a vector of conditioning variables $\mathbf{X}$: $h_{j,k} = \frac{e^{\alpha_{k} + \mathbf{BX}}}{1 + e^{\alpha_{k} + \mathbf{BX}}}$. The hazard ...


6

Combining proportions dying as you do is not giving you cumulative hazard. Hazard rate in continuous time is a conditional probability that during a very short interval an event will happen: $$h(t) = \lim_{\Delta t \rightarrow 0} \frac {P(t<T \le t + \Delta t | T >t)} {\Delta t}$$ Cumulative hazard is integrating (instantaneous) hazard rate over ...


6

You seem to be talking about a simple parametric survival model. An exponential survival model would have survivor function $S(t)=e^{-\lambda_it}$, and hazard rate $\lambda_i$. (The function $f_i(t)= \lambda_ie^{-\lambda_it}$ would be the failure density.) A parametric survival model is akin to a regression or a GLM, in that it has linear predictors, but (...


6

muhaz() doesn't return the baseline hazard rate, but the hazard function including the contribution of covariates to the final hazard. You can divide the two contribution as I do with this code. First start simulating a dataset with a fixed hazard rate $h_0$: library(survival) set.seed(6) n <- 200 age <- 50 + 12*rnorm(n) sex <- factor(...


6

The Proportional Hazards Assumption is an assumption that the hazard function is proportional between two (or more) groups. So, for example, if you have "High Risk" and "Low Risk" patients, their survival functions can change over time, but as long as they change in a way where they are still proportional to one another, the assumption is met. What you're ...


5

The answer is that both are used, unfortunately. In the continuous case, you are right the distinction is unimportant. In the discrete case, the interpretation would be slightly different and therefore clarity is important. In my experience, the most common definition of the survival function is $S(t) = Pr(T>t)$ and so would match your yellow column. ...


5

I'd HAZARD a guess that it's noteworthy owing to its use in diagnostic plots: (1) In the Cox proportional hazards model $h(x)=\mathrm{e}^{\beta^\mathrm{T} z}h_0(x)$, where $\beta$ and $z$ are the coefficient and covariate vectors respectively, & $h_0(x)$ is the baseline hazard function; & so $\log H(x)=\beta^\mathrm{T} z + H_0(x)$. If you plot the ...


5

You're just doing exponential survival, e.g. parametric survival. See ?survreg in the survival package. If you specify dist='exponential' as an argument, it will assume a constant hazard function and estimate that baseline hazard along with the hazard ratios. It will not, for instance, take a user supplied baseline hazard and estimate the hazard ratios of ...


Only top voted, non community-wiki answers of a minimum length are eligible