New answers tagged

1

The complementary CDF of the random variable $X$ with hazard rate $\lambda(t)$ is $$1- F_X(x) = \exp\left(-\int_0^x \lambda(t) \,\mathrm dt\right).$$ The complementary CDF of the random variable $Y$ with hazard rate $c\lambda(t)$ is \begin{align} 1-F_y(x) &= \exp\left(-\int_0^x c\lambda(t) \,\mathrm dt\right)\\ &= \left[\exp\left(-\int_0^x \lambda(t) ...


2

It is your decision on what you define as churn. This is something to discuss with business people who are going to use those results. The definitions will vary on case-by-case basis. Usually what is used is some threshold that is meaningful from business perspective.


0

It's not necessarily true that including the playback errors will be erroneous. Yes, you will have more playback errors as times progresses, but a properly defined model (unlike a simple correlation of errors with session length) would effectively be comparing situations at constant overall session length that have different histories of prior playback ...


1

A Cox model estimates the hazard, i.e. instantaneous rate of occurrence of events, at time $t$ given a set of predictors, $x$. Denote this as $h(t|X=x)$. There are two parts to the model: the so-called "baseline hazard", $h_0(t)$, which is interpreted as the hazard function over $t$ for an observation with covariate pattern $X=0$, and the hazard ...


2

The number of deaths among the number of diagnosed cases is called case fatality rate. The number of deaths scaled to the size of the population is called mortality rate. One can't say that "so far, a random Canadian would have been less likely to die from coronavirus than a random person in the US", because there is a lag between infection and ...


1

The number of deaths per million essentially gives an estimate of the likelihood of death attributable to coronavirus in the overall population, normalizing the number of deaths to the population of a country (note this only counts death attributable to coronavirus, as it cannot count undiagnosed cases). Countries with larger population will naturally have ...


3

Don't balance, in neither case. Are unbalanced datasets problematic, and (how) does oversampling (purport to) help? (Converted from a comment. For my rationale, see here. On short answers, see here. Better and longer answers are always welcome.)


0

If you have a categorical variable with $K$ levels, then new $K-1$ variables are created and the output presents results for each level of a categorical variable with respect to the variable's baseline level. You will have one less coefficient than you have levels of the variable. For continuous variables, hazard ratio tells you what is the unique (assuming ...


0

In general one cannot stratify by a variable and report its effect. Consider trying the restricted mean survival time, which can handle situations where the proportional hazards assumption does not hold. Obtaining adjusted measures using this method is complicated, but possible.


0

You are correct that time is not the default output of a Cox model. However, for any given unit with its covariate pattern, the model gives a relative hazard. By definition, units with higher hazard ratios should have shorter time to event. The censored c-index compares the estimated hazard ratio to both the actual event status and actual time to event (or ...


1

Below is my attempt to answer this question. Concordance index is a measure of how discriminant your model is. For survival analysis, say you have a covariate $X$ and a survival time $T$. Assume that higher values of $X$ imply shorter value for $T$ (thus $X$ has a deleterious effect on $T$). Discrimination means that you are able to say, with high ...


0

If there aren't proportional hazards then no single hazard ratio adequately summarizes the results. The hazard ratio between the two groups is changing with time. A vignette for the R survival package on time-dependent survival models covers both time-dependent covariates and how to deal with time-dependent coefficients/hazard ratios. Start there for ideas ...


3

A Cox model with a covariate $X$ is defined as $$ \lambda(t \mid X) = \lambda_0(t) \exp \left( \beta X \right) $$ where $\lambda_0(t)$ is the baseline risk and $e^\beta$ is the hazard-ratio. A Cox model stratified upon a categorical variable $Y$ with $k$ modalities is a Cox model where a different baseline risk is used for each group: $$ \lambda_k(t \mid X) :...


1

They used integration by parts. If $h$ and $g$ are functions then since $(hg)' = h'g + hg'$, $$ \int h'g = [hg] - \int hg' $$ Here in the integral $$ \int_{0}^{t^*} t^2 f(t) dt $$ they used $h'(t)=f(t)$ (thus $h(t) = F(t)$) and $g(t)=t^2$ (and $g'(t) = 2t$) which gives, \begin{align*} \int_{0}^{t^*} t^2 f(t) dt &= \left[t^2 F(t) \right]_0^{t^*} - \int_0^{...


2

The Kaplan–Meier estimator for survival probability, $S[t]$, is computed as a product of survival probabilities over disjoint sub-intervals $$ S[t] = \prod_{k \le t} s_k $$ where $s_k$ is the probability to survive over $t=[k-1,k)$. In your case, the atomic sub-intervals correspond to columns of your table $n_{:,k}$. For a single row (i.e. cohort), $i$, you ...


1

This might be helpful: https://cran.r-project.org/web/packages/SurvRegCensCov/vignettes/weibull.pdf Quoting from the first page: Weibull accelerated failure time regression can be performed in R using the survreg function. The results are not, however, presented in a form in which the Weibull distribution is usually given. Accelerated failure time ...


1

Inside the function ecdf only unique values of the argument x are used. In your case length(unique(y)) returns 91. I've attached a reproducible example. What I've done: The function ecdf returns a function of class 'ecdf' as it is stated in the description file. So I've used the returned function to compute the empirical cdf of the given data. The survival ...


2

In the case of a binary outcome and a continuous predictor, the AUC of the ROC or c-index is simply a function of how well the ordered values of the continuous predictor correlate to the corresponding event status. In a Cox model or other time to event method, those persons with a higher predictor value (hazard ratio) should have a shorter time to event. In ...


0

You can't take the ratios of the individual hazard ratio CI limits to do this. Exponentiating the estimates based on the Cox model coefficients to get hazard ratios is the last thing that you should do when you are performing calculations with Cox models. You work in the scale of model coefficients, whose estimates are assumed to have multivariate normal ...


0

Harrell has two L's. The c-index works fine in the rare outcome case. It is not prevalence-dependent, but its standard error will be properly large to account for the fact that you have limited information upon which to estimate the concordance probability. Be sure to accompany all estimates with the standard error, which is computed in the R survival ...


0

As stated in the comments, I ended up using the method given by @Rootless17b. I don't think this is the answer I was looking for (see comment) but it worked nonetheless. I recently stumbled upon Gerds et al. riskRegression package and in particular the predictCox function. I have not explored it in depth but I think this does what I wanted. Refs: https://...


2

For survival analysis, Kleinbaum (2013) - Survival Analysis -- A self-learning text is straightforward with R examples. It's even freely available on Springer now due to COVID-related university lockdowns: https://link.springer.com/book/10.1007%2F978-1-4419-6646-9. I think Frank Harrell's Regression Modelling Strategies is also freely available now for the ...


3

This is not a bivariate Cox model. It is a Cox model with two predictors ("multiple" not "multivariate"). "Bivariate" is an unfortunate use of terminology. Nor is it even a stratified Cox model in the sense of having more than one baseline hazard function-- "stratified" here means that you look at associations with one ...


1

You cannot derive absolute changes or differences in time directly from the hazard ratios. You can create fitted mortality or survival curves and consider differences in survival or mortality at a common time point or compare the time until a common cumulative mortality or survival is encountered. While reductions in hazard are commonly referred to as ...


3

You get NA because not enough people have died yet to estimate the upper confidence. Leaving out the precise details of how it's done in R, conceptually the way to get a confidence interval for median survival is to get a confidence interval for the survival curve and cut it at 50%. If the upper limit of the survival curve hasn't reached 50%, there is no ...


1

The advantage in Cox regression--that you don't need to specify a form for the baseline hazard as a function of time--becomes a disadvantage in this case. You can't make general statements about mean survival times or survival probabilities at specific times from the coefficients of a Cox model unless you also specify the corresponding baseline hazard. This ...


0

I'd like to add an answer with a code example for further clarity. What we're essentially after is taking the survreg output model and derive from it the survival function. To avoid the common notation confusion I'll actually go ahead and show the code that does that: fit <- survreg(Surv(time,status) ~ age, data=stanford2) # this is the survreg output ...


1

You are trying to apply splines to predictors that aren't continuous variables, while not recognizing that one of those variables had only a limited number of distinct values. In the lung data "inst" is an institution code that should be treated as an unordered 17-level factor or, better, as a random effect; "ph.ecog" is a potentially 5-...


0

From some of the same authors, there is another book focused more on the intuition and practicalities than the the math: Hastie, T., Tibshirani, R., & Friedman, J. (2009). The Elements of Statistical Learning. Springer Verlag. https://web.stanford.edu/~hastie/ElemStatLearn/ Efron and Hastie also have a great book that is doable even if you skip over the ...


0

Speaking directly to your graphic and question, the person recorded as having experienced an event by time 1 experienced it after $\boldsymbol{t=0}$ but no later than $\boldsymbol{t=1}$ on your timeline. You can think of time equal $t$ as compassing the interval of possible times $>t-1$ and $\leq t$. So the value of $t=1$ corresponds to events occurring ...


2

For GLMs I recommend Faraway's Extending the Linear Model with R. I would also recommend Frank Harrell's Regression Modeling Strategies, which provides a nice in depth explanation of regression as a whole and various extensions including survival modeling. Both textbooks include code in R.


2

Generally, the time at which the event is discovered to have occurred is the time that is used for the endpoint. In clinical trials, the screening interval is prespecified for the endpoint so as to improve the timeliness of detection. To expand: we also don't use "time 0" in analyses. So at any time after randomization (or appropriate time point) ...


5

If you’re interested in Bayesian Inference then there’s a wonderful book (goes into GLMs quite a lot) called Statistical Rethinking by Richard McElreath. The second edition is just out and there’s lecture series on YouTube. The most recent series (called Winter 2019 IIRC) follows the second edition.


9

For time series analysis: "Forecasting Principles and Practices" by Hyndman and Athanasopoulos is absolutely excellent and is roughly on the same order of mathematical complexity as ISLR (i.e. enough, but not too much). It has the additional bonus of being available for free online, and having many code examples. It has one weak point: It doesn't ...


3

Haven't read this new edition, but the first edition is a classic, so this one, available starting September 2020, will be a great reference for sure. https://www.amazon.com/Regression-Stories-Analytical-Methods-Research/dp/110702398X. I second the recommendation of "Statistical Rethinking" by Mooks, that's a great one.


0

I know that it's been a while since this question was first posted, but I came across this resource that may help you. Take a look at the slide that's third from the bottom: http://www.ams.sunysb.edu/~zhu/ams588/Lecture_5_AFT.pdf It seems that you can fit a couple of models, and given that, for example, the exponential distribution is a subset of the Gamma ...


0

When I run this analysis, I get very high estimates for Nest_Type and Risk_treatment. This results in very high hazard ratios (exp(estimate); 15432.58 and 5699.47, respectively) I am not familiar with survival analysis nor with the cloglog function but from what you wrote I am pretty sure that you found very high values because: You used the exponential ...


0

The paper by Chen et al "Too Many Covariates and Too Few Cases? – A Comparative Study," Stat. Med 2016 Nov 10;35(25):4546-4558, available in accepted form at PubMed Central here and in journal-edited form here (if you have access) gets directly at your problem. The paper is in the context of logistic regression, but the same principles apply to ...


1

It would seem to be wise to incorporate weights into proportional hazard (PH) tests as you are incorporating them into the Cox model itself. You presumably don't want a case that was down-weighted in the Cox regression to have disproportionate influence on a PH test. Section 3.5 of "The Survival Package" vignette for the R survival package (now at ...


3

This is however based on the assumption that each subject will die one day (does not have to be during study, those are so called censored data) and that the risk of dying is increasing in time (i.e. survival function is decreasing). Both of these "assumptions" are not necessary to perform survival analysis. In fact, they are not assumptions of ...


Top 50 recent answers are included