# NOT RUN {
library(rms)
fit <- cph(Surv(time,status)~ANLN+CENPA+GPR182+BCO2,LIRI)
two_scatter(fit,
cutoff.value = 'median',
cutoff.x = 142,
cutoff.y = -0.5)
# }
# NOT RUN {
#more detailed example
library(ggrisk)
#plot
two_scatter(fit)
#regulate cutoff
##hidden cutoff
two_scatter(fit,
cutoff.show = FALSE)
two_scatter(fit,
cutoff.value = 'median')
two_scatter(fit,
cutoff.value = 'roc')
two_scatter(fit,
cutoff.value = 'cutoff')
two_scatter(fit,
cutoff.value = -1)
two_scatter(fit,
cutoff.value = 'median',
cutoff.x = 142,
cutoff.y = -0.5)
#code for 0 and 1
two_scatter(fit,
cutoff.value = 'median',
cutoff.x = 142,
cutoff.y = -0.5,
code.0 = 'Still Alive',
code.1 = 'Dead')
#code for high and low risk group
two_scatter(fit,
cutoff.value = 'median',
cutoff.x = 142,
cutoff.y = -0.5,
code.0 = 'Still Alive',
code.1 = 'Dead',
code.highrisk = 'High Group',
code.lowrisk = 'Low Group')
#title for legend, x and y lab
two_scatter(fit,
cutoff.value = 'median',
cutoff.x = 142,
cutoff.y = -0.5,
code.0 = 'Still Alive',
code.1 = 'Dead',
code.highrisk = 'High Group',
code.lowrisk = 'Low Group',
title.A.legend = 'Riskscore',
title.B.legend = 'Event Status',
title.A.ylab = 'Riskscore',
title.B.ylab = 'Survival Time(year)',
title.xlab = 'This is rank')
#vertical just for y-axis lab
two_scatter(fit,
cutoff.value = 'median',
cutoff.x = 142,
cutoff.y = -0.5,
code.0 = 'Still Alive',
code.1 = 'Dead',
code.highrisk = 'High Group',
code.lowrisk = 'Low Group',
title.A.legend = 'Riskscore',
title.B.legend = 'Event Status',
title.A.ylab = 'Riskscore',
title.B.ylab = 'Survival Time(year)',
title.xlab = 'This is rank',
vjust.A.ylab = 1,
vjust.B.ylab = 3)
#size
two_scatter(fit,
cutoff.value = 'median',
cutoff.x = 142,
cutoff.y = -0.5,
code.0 = 'Still Alive',
code.1 = 'Dead',
code.highrisk = 'High Group',
code.lowrisk = 'Low Group',
title.A.legend = 'Riskscore',
title.B.legend = 'Event Status',
title.A.ylab = 'Riskscore',
title.B.ylab = 'Survival Time(year)',
title.xlab = 'This is rank',
vjust.A.ylab = 1,
vjust.B.ylab = 3,
size.AB = 2,
size.ylab.title = 14,
size.xlab.title = 14,
size.Atext = 12,
size.Btext = 12,
size.xtext = 12,
size.xyticks = 0.5,
size.xyline = 0.5,
size.dashline = 1.5,
size.points = 1,
size.cutoff = 5,
size.legendtitle = 14,
size.legendtext = 13)
#color
two_scatter(fit,
cutoff.value = 'median',
cutoff.x = 142,
cutoff.y = -0.5,
code.0 = 'Still Alive',
code.1 = 'Dead',
code.highrisk = 'High Group',
code.lowrisk = 'Low Group',
title.A.legend = 'Riskscore',
title.B.legend = 'Event Status',
title.A.ylab = 'Riskscore',
title.B.ylab = 'Survival Time(year)',
title.xlab = 'This is rank',
vjust.A.ylab = 1,
vjust.B.ylab = 3,
size.AB = 2,
size.ylab.title = 14,
size.xlab.title = 14,
size.Atext = 12,
size.Btext = 12,
size.xtext = 12,
size.xyticks = 0.5,
size.xyline = 0.5,
size.dashline = 1.5,
size.points = 1,
size.cutoff = 5,
size.legendtitle = 14,
size.legendtext = 13,
color.A = c(low='green',high='red'),
color.B = c(code.0='green',code.1='red'))
#famli and expand
two_scatter(fit,
cutoff.value = 'median',
cutoff.x = 142,
cutoff.y = -0.5,
code.0 = 'Still Alive',
code.1 = 'Dead',
code.highrisk = 'High Group',
code.lowrisk = 'Low Group',
title.A.legend = 'Riskscore',
title.B.legend = 'Event Status',
title.A.ylab = 'Riskscore',
title.B.ylab = 'Survival Time(year)',
title.xlab = 'This is rank',
vjust.A.ylab = 1,
vjust.B.ylab = 3,
size.AB = 2,
size.ylab.title = 14,
size.xlab.title = 14,
size.Atext = 12,
size.Btext = 12,
size.xtext = 12,
size.xyticks = 0.5,
size.xyline = 0.5,
size.dashline = 1.5,
size.points = 1,
size.cutoff = 5,
size.legendtitle = 14,
size.legendtext = 13,
color.A = c(low='green',high='red'),
color.B = c(code.0='green',code.1='red'),
family = 'sans', # sans for Arail, serif for Times New Roman
expand.x=10)
# }
Run the code above in your browser using DataLab