forestPlot-ModelComparison-method: Render a forest plot from the 'validationStats' slot of a...

Description Usage Arguments Value Examples

Description

Render a forest plot from the validationStats slot of a PCOSP model object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## S4 method for signature 'ModelComparison'
forestPlot(
  object,
  stat,
  groupBy = "cohort",
  colourBy = "model",
  vline,
  ...,
  xlab,
  ylab,
  transform,
  colours,
  title
)

Arguments

object

A ModelComparison object to forest plot.

stat

A character vector specifying a statistic to plot.

groupBy

A character vector with one or more columns in validationStats to group by. These will be the facets in your forestplot.

colourBy

A character vector specifying the columns in validationStats to colour by.

vline

An integer value on the x-axis to place a dotted vertical line.

...

Force subsequent parameters to be named, not used.

xlab

A character vector specifying the desired x label. Automatically guesses based on the stat argument.

ylab

A character vector specifying the desired y label. Defaults to 'Cohort (P-value)'.

transform

The name of a numeric function to transform the statistic before making the forest plot.

colours

A character vector of colours to pass into ggplot2::scale_fill_manual, which modify the colourBy argument.

title

A character vector with a title to add to the plot.

Value

A ggplot2 object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
data(sampleValPCOSPmodel)
data(sampleClinicalModel)
data(sampleCohortList)

# Set parallelization settings
BiocParallel::register(BiocParallel::SerialParam())

# Train the models
trainedClinicalModel <- trainModel(sampleClinicalModel)

# Predict risk/risk-class
ClinicalPredCohortL <- predictClasses(sampleCohortList[c('PCSI', 'TCGA')],
  model=trainedClinicalModel)

# Validate the models
validatedClinicalModel <- validateModel(trainedClinicalModel,
  valData=ClinicalPredCohortL)

# Compare the models
modelComp <- compareModels(sampleValPCOSPmodel, validatedClinicalModel)

# Make the forest plot
modelComp <- modelComp[modelComp$isSummary == TRUE, ]
modelCindexCompForestPlot <- forestPlot(modelComp, stat='concordance_index')

bhklab/PDATK documentation built on Dec. 27, 2021, 7:46 a.m.