Created
November 10, 2022 13:33
-
-
Save MJacobs1985/0942af3cdc7aa331e16f1a13c91cbfd4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Log-log plot for categorized predictor | |
KM_Surv <-with(pancreas2, Surv(SurvTime,Event==1)) | |
KM_by_Tumorsite <-npsurv(KM_Surv~Tumorsite_in_pancreas, data=pancreas2, type="kaplan-meier", conf.type="log-log") | |
KM_by_DiseaseStage <-npsurv(KM_Surv~Disease_stage_at_consultation, data=pancreas2, type="kaplan-meier", conf.type="log-log") | |
KM_by_Gender <-npsurv(KM_Surv~Gender, data=pancreas2, type="kaplan-meier", conf.type="log-log") | |
KM_by_Non_Opioid <-npsurv(KM_Surv~Non_opioid_spec, data=pancreas2, type="kaplan-meier", conf.type="log-log") | |
KM_by_Opioid <-npsurv(KM_Surv~Opioid_spec, data=pancreas2, type="kaplan-meier", conf.type="log-log") | |
KM_by_Surgery <-npsurv(KM_Surv~Surgery_prior_to_consultation, data=pancreas2, type="kaplan-meier", conf.type="log-log") | |
KM_by_TotalDose <-npsurv(KM_Surv~RT, data=pancreas2, type="kaplan-meier", conf.type="log-log") | |
par(mfrow=c(4,2)) | |
plot(KM_Surv,fun="cloglog", main="Log-log Survival Curve", xlab="Time", ylab="Log-log Survival Probability", col=c(1,2), lty=c(1,2)) | |
plot(KM_by_Tumorsite,fun="cloglog", main="Log-log Survival Curve for Tumor Site", xlab="Time", ylab="Log-log Survival Probability", col=c(1,2), lty=c(1,2)) | |
plot(KM_by_DiseaseStage,fun="cloglog", main="Log-log Survival Curve for Disease Stage", xlab="Time", ylab="Log-log Survival Probability", col=c(1,2), lty=c(1,2)) | |
plot(KM_by_Gender,fun="cloglog", main="Log-log Survival Curve for Gender", xlab="Time", ylab="Log-log Survival Probability", col=c(1,2), lty=c(1,2)) | |
plot(KM_by_Non_Opioid,fun="cloglog", main="Log-log Survival Curve for Non-Opioid", xlab="Time", ylab="Log-log Survival Probability", col=c(1,2), lty=c(1,2)) | |
plot(KM_by_Opioid,fun="cloglog", main="Log-log Survival Curve for Opioid", xlab="Time", ylab="Log-log Survival Probability", col=c(1,2), lty=c(1,2)) | |
plot(KM_by_Surgery,fun="cloglog", main="Log-log Survival Curve for Surgery", xlab="Time", ylab="Log-log Survival Probability", col=c(1,2), lty=c(1,2)) | |
plot(KM_by_TotalDose,fun="cloglog", main="Log-log Survival Curve for Totdal Dose", xlab="Time", ylab="Log-log Survival Probability", col=c(1,2), lty=c(1,2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment