Last data update: 2014.03.03

R: Visualization of Covariates Traces
plot_boxtraceR Documentation

Visualization of Covariates Traces

Description

Function for plotting the cross-validated covariates traces of a PRSP object. Plot the cross-validated modal trace curves of covariate importance and covariate usage of the pre-selected covariates specified by user at each iteration of the peeling sequence (inner loop of our PRSP algorithm).

Usage

  plot_boxtrace(object,
                main = NULL,
                xlab = "Box Mass", 
                ylab = "Covariate Range (centered)",
                toplot = object$cvfit$cv.used,
                center = TRUE, 
                scale = FALSE, 
                col.cov, 
                lty.cov, 
                lwd.cov, 
                col = 1, 
                lty = 1, 
                lwd = 1, 
                cex = 1, 
                add.legend = FALSE, 
                text.legend = NULL,
                device = NULL, 
                file = "Covariate Trace Plots", 
                path=getwd(), 
                horizontal = FALSE, 
                width = 8.5, 
                height = 8.5, ...)

Arguments

object

Object of class PRSP as generated by the main function sbh.

main

Character vector. Main Title. Defaults to.

xlab

Character vector. X axis label. Defaults to "Box Mass".

NULL

ylab

Character vector. Y axis label. Defaults to "Covariate Range (centered)".

toplot

Numeric vector. Which of the pre-selected covariates to plot (in reference to the original index of covariates). Defaults to covariates used for peeling.

center

Logical scalar. Shall the data be centered?. Defaults to TRUE.

scale

Logical scalar. Shall the data be scaled? Defaults to FALSE.

col.cov

Integer vector. Line color for the covariate importance curve of each selected covariate. Defaults to vector of colors of length the number of selected covariates. The vector is reused cyclically if it is shorter than the number of selected covariates.

lty.cov

Integer vector. Line type for the covariate importance curve of each selected covariate. Defaults to vector of 1's of length the number of selected covariates. The vector is reused cyclically if it is shorter than the number of selected covariates.

lwd.cov

Integer vector. Line width for the covariate importance curve of each selected covariate. Defaults to vector of 1's of length the number of selected covariates. The vector is reused cyclically if it is shorter than the number of selected covariates.

col

Integer scalar. Line color for the covariate trace curve. Defaults to 1.

lty

Integer scalar. Line type for the covariate trace curve. Defaults to 1.

lwd

Integer scalar. Line width for the covariate trace curve. Defaults to 1.

cex

Integer scalar. Symbol expansion used for titles, legends, and axis labels. Defaults to 1.

add.legend

Logical scalar. Should the legend be added to the current open graphics device?. Defaults to FALSE.

text.legend

Character vector of legend content. Defaults to NULL.

device

Graphic display device in {NULL, "PS", "PDF"}. Defaults to NULL (standard output screen). Currently implemented graphic display devices are "PS" (Postscript) or "PDF" (Portable Document Format).

file

File name for output graphic. Defaults to "Covariate Trace Plots".

path

Absolute path (without final (back)slash separator). Defaults to working directory path.

horizontal

Logical scalar. Orientation of the printed image. Defaults to FALSE, that is potrait orientation.

width

Numeric scalar. Width of the graphics region in inches. Defaults to 8.5.

height

Numeric scalar. Height of the graphics region in inches. Defaults to 8.5.

...

Generic arguments passed to other plotting functions.

Details

The trace plots limit the display of traces to those only covariates that are used for peeling. If centered, an horizontal black dotted line about 0 is added to the plot.

Due to the variability induced by cross-validation and replication, it is possible that more than one covariate be used for peeling at a given step. So, for simplicity of the trace plots, only the modal or majority vote trace value (over the folds and replications of the cross-validation) is plotted.

The top plot shows the overlay of covariate importance curves for each covariate. The bottom plot shows the overlay of covariate usage curves for each covariate. It is a dicretized view of covariate importance.

Both point to the magnitude and order with which covariates are used along the peeling sequence.

Value

Invisible. None. Displays the plot(s) on the specified device.

Note

End-user plotting function.

Author(s)

Maintainer: "Jean-Eudes Dazard, Ph.D." jxd101@case.edu

Acknowledgments: This project was partially funded by the National Institutes of Health NIH - National Cancer Institute (R01-CA160593) to J-E. Dazard and J.S. Rao.

References

  • Dazard J-E., Choe M., LeBlanc M. and Rao J.S. (2015). "Cross-validation and Peeling Strategies for Survival Bump Hunting using Recursive Peeling Methods." Statistical Analysis and Data Mining (in press).

  • Dazard J-E., Choe M., LeBlanc M. and Rao J.S. (2014). "Cross-Validation of Survival Bump Hunting by Recursive Peeling Methods." In JSM Proceedings, Survival Methods for Risk Estimation/Prediction Section. Boston, MA, USA. American Statistical Association IMS - JSM, p. 3366-3380.

  • Dazard J-E., Choe M., LeBlanc M. and Rao J.S. (2015). "R package PRIMsrc: Bump Hunting by Patient Rule Induction Method for Survival, Regression and Classification." In JSM Proceedings, Statistical Programmers and Analysts Section. Seattle, WA, USA. American Statistical Association IMS - JSM, (in press).

  • Dazard J-E. and J.S. Rao (2010). "Local Sparse Bump Hunting." J. Comp Graph. Statistics, 19(4):900-92.

Examples

#===================================================
# Loading the library and its dependencies
#===================================================
library("PRIMsrc")

#=================================================================================
# Simulated dataset #1 (n=250, p=3)
# Non Replicated Combined Cross-Validation (RCCV)
# Peeling criterion = LRT
# Optimization criterion = LRT
#=================================================================================
CVCOMB.synt1 <- sbh(dataset = Synthetic.1, 
                    cvtype = "combined", cvcriterion = "lrt",
                    B = 1, K = 5, 
                    vs = TRUE, cpv = FALSE, 
                    decimals = 2, probval = 0.5, 
                    arg = "beta=0.05,
                           alpha=0.1,
                           minn=10,
                           L=NULL,
                           peelcriterion="lr"",
                    parallel = FALSE, conf = NULL, seed = 123)

plot_boxtrace(object = CVCOMB.synt1,
              main = paste("Cross-validated trace plots for model #1", sep=""),
              xlab = "Box Mass", ylab = "Covariate Range (centered)",
              toplot = CVCOMB.synt1$cvfit$cv.used,
              center = TRUE, scale = FALSE,
              device = NULL, file = "Covariate Trace Plots", path=getwd(),
              horizontal = FALSE, width = 8.5, height = 8.5)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(PRIMsrc)
Loading required package: parallel
Loading required package: survival
Loading required package: Hmisc
Loading required package: lattice
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-5

Loading required package: MASS
PRIMsrc 0.6.3
Type PRIMsrc.news() to see new features, changes, and bug fixes

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PRIMsrc/plot_boxtrace.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plot_boxtrace
> ### Title: Visualization of Covariates Traces
> ### Aliases: plot_boxtrace
> ### Keywords: Exploratory Survival/Risk Analysis Survival/Risk Estimation &
> ###   Prediction Non-Parametric Method Cross-Validation Bump Hunting
> ###   Rule-Induction Method
> 
> ### ** Examples
> 
> #===================================================
> # Loading the library and its dependencies
> #===================================================
> library("PRIMsrc")
> 
> #=================================================================================
> # Simulated dataset #1 (n=250, p=3)
> # Non Replicated Combined Cross-Validation (RCCV)
> # Peeling criterion = LRT
> # Optimization criterion = LRT
> #=================================================================================
> CVCOMB.synt1 <- sbh(dataset = Synthetic.1, 
+                     cvtype = "combined", cvcriterion = "lrt",
+                     B = 1, K = 5, 
+                     vs = TRUE, cpv = FALSE, 
+                     decimals = 2, probval = 0.5, 
+                     arg = "beta=0.05,
+                            alpha=0.1,
+                            minn=10,
+                            L=NULL,
+                            peelcriterion="lr"",
+                     parallel = FALSE, conf = NULL, seed = 123)

Survival dataset provided.

Requested single 5-fold cross-validation without replications 
Cross-validation technique:  COMBINED 
Cross-validation criterion:  LRT 
Variable pre-selection: TRUE 
Computation of permutation p-values: FALSE 
Peeling criterion:  LRT 
Parallelization: FALSE 

Pre-selection of covariates and determination of directions of peeling... 
Pre-selected covariates:
X1 X2 X3 
 1  2  3 
Directions of peeling at each step of pre-selected covariates:
X1 X2 X3 
 1 -1 -1 
Fitting and cross-validating the Survival Bump Hunting model using the PRSP algorithm ... 
replicate : 1
seed : 123
Fold : 1
Fold : 2
Fold : 3
Fold : 4
Fold : 5
Success! 1 (replicated) cross-validation(s) has(ve) completed 
Generating cross-validated optimal peeling lengths from all replicates ...
Generating cross-validated box memberships at each step ...
Generating cross-validated box rules for the pre-selected covariates at each step ...
Generating cross-validated modal trace values of covariate usage at each step ...
Covariates used for peeling at each step, based on covariate trace modal values:
X1 X2 
 1  2 
Generating cross-validated box statistics at each step ...
Finished!
> 
> plot_boxtrace(object = CVCOMB.synt1,
+               main = paste("Cross-validated trace plots for model #1", sep=""),
+               xlab = "Box Mass", ylab = "Covariate Range (centered)",
+               toplot = CVCOMB.synt1$cvfit$cv.used,
+               center = TRUE, scale = FALSE,
+               device = NULL, file = "Covariate Trace Plots", path=getwd(),
+               horizontal = FALSE, width = 8.5, height = 8.5)
Device:  2 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>