I conducted an experiment with human subjects in which the independent variable has 3 treatment levels and the dependent variable is the duration of time that passes before the subject engages in a specific action of interest. The minimum duration is 0 seconds and the maximum is 900 seconds (i.e., 15 minutes, at which point the experimenter ends the experiment).

It seems I could use a nonparametric text like Wilcoxon rank sum (to conduct pairwise comparisons), but I'm not sure if this is the most sensitive/appropriate test I could use. I know survival analysis is sometimes used, but again not sure if it's better or more appropriate than a nonparametric test.

I'd also like to know if there is an advantage to using a survival analysis/log-rank test over the Wilcoxon rank sum (aka Mann-Whitney U test).

Finally, I'm not clear on how to run the survival analysis.

  • 1
    $\begingroup$ This question seems almost identical to yours. Note that with 3 treatment levels in your case your question should be about using Kruskal-Wallis versus survival analysis, not Mann-Whitney versus survival analysis. Please look at the question and answer I linked, and edit your question to ask specifically about things they don't answer for you. $\endgroup$ – EdM May 9 '16 at 21:11
  • $\begingroup$ @EdM, I have 3 groups, but I'm interested in making a series of pairwise comparisons. The answer to the other question is helpful, but it doesn't indicate whether/why survival analysis is better than something like Mann-Whitney. Also, I am having a lot of trouble finding information on how to run the survival analysis in R (how the data should be set up). $\endgroup$ – PanPsych May 9 '16 at 21:40

As the linked question suggests, in this type of case with all censoring at the same time after all of the "events" have occurred, the log-rank survival test and the non-parametric tests like Mann-Whitney should be essentially equivalent, perhaps except for some differences in how tied ranks/times are handled.

The advantage of survival analysis is that it's designed specifically for this type of situation and can provide the often-appropriate proportional hazards regression as an option. In R you need to have a data frame with one row per individual, a column for the treatment (coded as a factor variable), columns for any other predictor variables, a column for the event time (or last follow-up time, 900 seconds in your case), and a column indicating whether the time corresponds to an event (1) or censoring (0). Note that this coding of censoring can differ among software packages (it's opposite for MATLAB as I recall).

The regression is then done with a Surv object as provided by the R survival package as the dependent variable. The survdiff function does this with a non-parametric test, the coxph function under the proportional hazards assumption.

With 3 treatment groups the standard procedure is to test first whether there are any differences among groups with a global test, then to do between-group comparisons with correction for the multiple comparisons.

  • $\begingroup$ Thanks, @EdM. Is there an advantage to using survdiff vs coxph? I am not sure if the proportional hazards assumption is appropriate for my data. Also, I don't understand the test enough to know if it's one-sided or two? Can the p-value be halved given a directional hypothesis (that one group will do more poorly on average)?\ $\endgroup$ – PanPsych May 10 '16 at 15:30
  • $\begingroup$ With coxph you get relative magnitudes of effects, not just that treatment effects differ, and it allows for multiple regression and interactions. Tools in the survival package can test the proportional hazards assumption. A web search of "r survival analysis" will show links to many freely available explanations, if the documentation in survival isn't enough. Normally, the null hypothesis is that there are no differences among treatments, with a 2-sided test of that hypothesis. I'm reluctant to give advice on pre-specified directional hypotheses. $\endgroup$ – EdM May 10 '16 at 17:57

I think EdM answered your question about what analysis to do. Regarding implementation, Introducing Survival and Event History Analysis by Melinda Mills is an excellent introduction to survival analysis in R. It is aimed at beginners in R and includes an entire chapter on formatting your data (which is half the battle).

  • 1
    $\begingroup$ I've ordered the book - thanks! Most of what I've come across on the internet has been really difficult to understand (and I'm not terribly slow), so I'm looking forward to an accessible intro. $\endgroup$ – PanPsych May 12 '16 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.