I have a diagnostic test performed on 100 participants at baseline. I then follow up these participants for variable periods of time and have data regarding survival.

I have used a Cox regression model to calculate a hazard ratio, and used the Mantel-cox log rank to test whether a positive test predicts death.

I would like to calculate time specific version of sensitivity and specificity of the test. I have been using the 'survivalROC' package in R to do this.

num_subj = NROW(data)
survivalROC(Stime = data$survival_time, #time till censoring
marker = data$positive_test, #1 for positive, 0 for negative
status = data$death, #whether subject dead or alive
predict.time = 2, #cutoff time
span = 0.25*num_subjects^(-0.20))

From this I get 'True positive' and 'False positive values'

If I then run the same code but this time with

marker = data$negative_test, #1for negative, 0 for positive

I will get different True/false positive values.

My question is: can I put these 4 numbers in a 2x2 table (the values from the marker = data$negative_test used as the values for true and false negative) and calculate sensitivity and specificity in the usual manner (e.g. sens = TP/(TP+FN))?

Or please let me know if this whole approach is misguided and there are superior alternatives.

  • $\begingroup$ The fact that this give the same results for sensitivity and specificity as the td.sesns.spec function from: rdrr.io/bioc/survcomp/man/td.sens.spec.html reassures me that this may be an ok solution $\endgroup$ – RobMcC Sep 15 '17 at 10:37

Your Answer

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

Browse other questions tagged or ask your own question.