# how can I focus the log rank test in a selected period of time of follow up?

I am using R survdiff (survival package). I would like to focus the analysis on the first 2 years of my survival curve (that is actually much longer, but with few cases in the long term and with possible superimposed curves between the groups). What should I do to focus the analysis on these first 2 years only? Should I subset the dataset?

• Could you elaborate on what you mean by "focus the analysis"? Does that mean "use only data from the first two years," or could it perhaps mean "use all the data but produce estimates or predictions only for the first two years," or might it mean "weight the first two years more heavily than other times," or maybe something else? – whuber Dec 24 '15 at 16:49
• I believe the reviewer wants me to weight the first two years more heavily as after two years the curves are parallel and virtually superimposed. Thanks – bvd75 Dec 25 '15 at 18:12

Before proceeding, you should ask yourself "Why limit follow-up to two years?" If there is some rational reason for truncating follow-up at two years and you are committed to using the Kaplan-Meier method and the log-rank test, you will need to recode your censoring indicator and the follow-up time to reflect a maximum follow-up of two years:

#load required package
install.packages("survival")
library("survival")

#generate the data
set.seed(42)
time <- abs(rnorm(42, mean=0, sd=1 ))*1800
event <- sample( c(0,0,1), 42, replace=TRUE)
group <- sample( c(1,2), 42, replace=TRUE)

#reform data for maximum follow-up of two years
time_730 <- ifelse(time>=730, 730, time)
event_730 <- ifelse(time>=730, 0, event)

#logrank test at two years
summary( Surv(time_730, event_730))

survdiff( Surv(time_730, event_730) ~ group)


You mention overlapping curves or violation of the proportional hazards assumption. If this assumption is violated, you will need to look carefully at your curves before accepting the logrank p-value as a true test of the equality of survival experiences.

• Dear Todd thanks for your kind and very clear reply. I have been asked by a reviewer to "focus the analysis" on the first 2 years as the curves look superimposed after that time. I guess I should weight the first two years more heavily than the others. I have also run a Cox PHM, but now I wonder what should I do,considering this superimposition of the curve. The first two years are really different, but after that the curves are parallel. Thanks – bvd75 Dec 25 '15 at 17:03
• If you can show a graph of the groups, this would be helpful in working toward a solution. The presence of overlapping curves may or may not demand a different approach. Ultimately, the approach will depend on your question. Delayed acceleration/deceleration of hazard in either of your groups may or may not be important. – Todd D Dec 26 '15 at 16:24
• – bvd75 Dec 27 '15 at 9:26
• The logrank test should work well at two years of follow-up and throughout all of the available follow-up. The curves no not cross appreciably based on the provided graph. While there may be some early overlap, the logrank p-value will offer you a reasonable result. If you want to be very conservative, report both the logrank p-value and the Wilcoxon p-value. The Wilcoxon test will weight the early experience, where there may be some overlap, and in doing so will bias your result toward the null hypothesis of no difference between groups. – Todd D Dec 28 '15 at 0:16

I would subset the data by the date range you are interested in. if I was to run this analysis I would use an an input field in order to do some what-if modeling along the date-range.

• Your second sentence seems to be garbled--perhaps you could edit it to make it meaningful? – whuber Dec 24 '15 at 16:50