--- title: "Prostate Package Vignette" author: "Yates Coley & Julia Bindman" date: "r Sys.Date()" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Vignette Title} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} ---

Loading Data

To analyze your code, you must first load in data from various clinical data sources. Load in data from .csv files for patient data, PSA data, biopsy data, and surgical data. Each .csv file must be saved to your local directory. Below, we describe the characteristics and variables of each dataset needed for input.

Patient-level data

demo_data<-read.csv("example-demo-data-IOP.csv")

This dataset should have one record (row) per patient. Required fields are:

Variable (column) names must be specified exactly as given above.

PSA data

psa_data<-read.csv("example-psa-data-IOP.csv") 

This dataset should have one record (row) per PSA test performed per patient. PSA tests prior to prostate cancer diagnosis should be included; PSA tests after surgery or other treatment should not be included. Required fields are:

Variable (column) names must be specified exactly as given above.

Biopsy data

bx_data<-read.csv("example-bx-data-IOP.csv") 

This dataset should have one record (row) per biopsy per patient prior to grade reclassification (RC), including diagnostic biopsy. Patients with RC on diagnostic biopsy are not eligible for active surveillance and should not be included in the analysis. No biopsies should occur after intial RC, surgery, or other treatment. Required fields are:

Variable (column) names must be specified exactly as given above.

Surgery data

surg_data<-read.csv("example-surg-data-IOP.csv") 

This dataset should have one record (row) per surgery performed. Patients without radical prostatectomy should not be included in this dataset. Patients with other curative intervention (e.g., radiation) prior to surgery should not be included in this dataset. Required fields are:

Variable (column) names must be specified exactly as given above.

Shaping data

Call function fillPatientTables to create dataframes based on combined data sources.

#having issues from remote download
ptDataframes <- ProstatePackage::fillPatientTables(demo_data, psa_data, bx_data, surg_data, IOP = TRUE)

This function will check the input datasets to ensure data meet the requirements detailed above. If data are not formatted properly, error messages will be produced and the function will not return the necessary dataframes for proceeding with analysis.

The IOP=TRUE option in this function indicates that the occurrence of biopsies and surgery may be informative of the underlying prostate cancer state to be predicted. To enforce the assumption that biopsy and surgical decisions are not informative, use IOP=FALSE. Required fields are:

Variable (column) names must be specified exactly as given above.

RJAGS Prep

Next, RJAGSprep will take the formatted dataframe created by fillPatientTables as input and prepare necessary arguments to complete the analysis in RJAGS.

jagsPrep <- ProstatePackage::RJAGSprep(pt = ptDataframes, IOP=TRUE)

Note that the JAGS model (model.file) is automatically written to your current working directory by RJAGSprep. Required fields are:

Finally, run the analysis with RJAGS according to desired specifications for chain length, burn-in, etc. (The example below runs a single short chain.) ``````r library(R2jags) ex.jags<-jags(data=RJAGSprepfull$jags_data, inits=RJAGSprepfull$inits, parameters.to.save=RJAGSprepfull$parameters.to.save, model.file="IOP-jags-model.txt", n.chains=1, n.iter=50, n.burnin=10, n.thin=1)

See documentation for R2jags for details on jags output.

#Print Individual Data

Use this function to print an individual's data from various clinical data sources.

```r
inputPatient <- ProstatePackage:::printIndividualData(pt.id = 198, pt = ptDataframes)

The function returns and prints a readable formatted table of patient data. Required fields are:

Plot Individual Data

Use this function to plot an individual's data.

# Data for Patient ID 198
ProstatePackage::plotPtData(pt.id = 198, what.data="both", log.scale=T, plot.psad=F)
# Data for Patient ID 250
ProstatePackage::plotPtData(pt.id = 250, what.data="both", log.scale=F, plot.psad=F)

The function plots various clinical data for an individual patiet. Required fields are:



jbindman/prostate-project documentation built on May 18, 2019, 5:59 p.m.