Learn R Programming

ggDCA (version 1.1)

ggplot.rFP.p100: Plot for decision curve

Description

Plot for decision curve

Plot for decision curve

Plot Decision Curve

Usage

# S3 method for rFP.p100
ggplot(
  data,
  mapping,
  color = TRUE,
  linetype = TRUE,
  lwd = 1.05,
  ...,
  environment = parent.frame()
)

# S3 method for dca.cph ggplot( data, mapping, color = TRUE, linetype = TRUE, lwd = 1.05, ..., environment = parent.frame() )

# S3 method for dca.lrm ggplot( data, mapping, color = TRUE, linetype = TRUE, lwd = 1.05, ..., environment = parent.frame() )

Arguments

data

results of dca() function

mapping

ignore

color

logical, whether models will be classified by color

linetype

logical, whether models will be classified by line type

lwd

line width

...

ignore

environment

ignore

Value

a ggplot2 picture

Examples

Run this code
# NOT RUN {
library(ggDCA)
library(rms)

######## logistic regression

model1 <- lrm(status~ANLN,LIRI)
d <- dca(model1,model.names = 'ANLN')
ggplot(d)

# }
# NOT RUN {
model2 <- lrm(status~ANLN+CENPA,LIRI)
d <- dca(model2,model.names = 'ANLN+CENPA')
ggplot(d)


model3 <- lrm(status~ANLN+CENPA+GPR182,LIRI)
d <- dca(model3,model.names = 'ANLN+CENPA+GPR182')
ggplot(d)

model4 <- lrm(status~ANLN+CENPA+GPR182+BCO2,LIRI)
d <- dca(model4,model.names = 'ANLN+CENPA+GPR182+BCO2')
ggplot(d)


d <- dca(model1,model2,model3,model4,
         model.names = c('ANLN',
                         'ANLN+CENPA',
                         'ANLN+CENPA+GPR182',
                         'ANLN+CENPA+GPR182+BCO2'))
ggplot(d,
       linetype = FALSE,
       color = c('blue','green','black','red','gray','gray'))


##########  cox regression

# evaluate at median time

model1 <- coxph(Surv(time,status)~ANLN,LIRI)
d <- dca(model1,model.names = 'ANLN')
ggplot(d)

model2 <- coxph(Surv(time,status)~ANLN+CENPA,LIRI)
d <- dca(model2,model.names = 'ANLN+CENPA')
ggplot(d)


model3 <- coxph(Surv(time,status)~ANLN+CENPA+GPR182,LIRI)
d <- dca(model3,model.names = 'ANLN+CENPA+GPR182')
ggplot(d)

model4 <- coxph(Surv(time,status)~ANLN+CENPA+GPR182+BCO2,LIRI)
d <- dca(model4,model.names = 'ANLN+CENPA+GPR182+BCO2')
ggplot(d)


d <- dca(model1,model2,model3,model4,
         model.names = c('ANLN',
                         'ANLN+CENPA',
                         'ANLN+CENPA+GPR182',
                         'ANLN+CENPA+GPR182+BCO2'))
ggplot(d,
       linetype = FALSE,
       color = c('blue','green','black','red','gray','gray'))



# evaluate at different times

qt <- quantile(LIRI$time,c(0.25,0.5,0.75))
qt=round(qt,2)
model1 <- coxph(Surv(time,status)~ANLN,LIRI)
d <- dca(model1,
         model.names = 'ANLN',
         times = qt)
ggplot(d)

model2 <- coxph(Surv(time,status)~ANLN+CENPA,LIRI)
d <- dca(model2,
         model.names = 'ANLN+CENPA',
         times = qt)
ggplot(d)


model3 <- coxph(Surv(time,status)~ANLN+CENPA+GPR182,LIRI)
d <- dca(model3,
         model.names = 'ANLN+CENPA+GPR182',
         times = qt)
ggplot(d)

model4 <- coxph(Surv(time,status)~ANLN+CENPA+GPR182+BCO2,LIRI)
d <- dca(model4,
         model.names = 'ANLN+CENPA+GPR182+BCO2',
         times = qt)
ggplot(d)


d <- dca(model1,model2,model3,model4,
         model.names = c('ANLN',
                         'ANLN+CENPA',
                         'ANLN+CENPA+GPR182',
                         'ANLN+CENPA+GPR182+BCO2'),
         times = qt)
ggplot(d)
# }

Run the code above in your browser using DataLab