Chapter 2 Quick Start with an Example

This section demonstrates the usage of PoissonERM using simulated data set.

The example folders are here: https://github.com/yuchenw2015/PoissonERM-Example.

Each example folder contains:

  • user-input.r: control script for modeling where setting and details about the analysis, exposures, covariates, and output are declared
  • obsdata.csv: data set for modeling
  • prediction-user-input-sim.r: control script for prediction of new simulated exposures. (optional)
  • simdata.csv: new simulated exposures. (required when using the prediction-user-input-sim.r functionality)

There are 3 main functions in PoissonERM:

  • ModelPoisson(): establish E-R relationship between exposures and endpoints via Poisson Regression.
  • PredictionPoisson(): generate prediction figure and table using the base model and the new simulated exposures.
  • ReportPoisson(): generate a report of the modeling results, with/without the prediction results.

The folders “Example1” (with prediction) and “Example2” (no prediction) contain all necessary files (control scripts or data sets) to run functions in PoissonERM. Details of the example inputs and datasets used:

  • 2 Exposure Metrics, 3 Categorical Covariates and 2 Continuous Covariates were considered in all 3 Endpoints;
  • All exposures, covariates and events were summarized by protocol number (“PROT”).
  • Threshold of low incidence rate was 10% therefore only 2 endpoints were considered in this analysis (Adverse Event 1 was with incidence rate lower than 10%).
  • Event sub-type was provided for all endpoints, which breaks down the “observed with event” and “not observed with event” outcomes into more detailed classification.
  • Included covariates in final model if there is any proper one(s).
  • Considered log- and sqrt-transformation for exposure metrics.
  • Considered log-transformation for continuous covariates.
  • No reference value for continuous covariates.
  • Exposure selection conducted following \(p\)-value significance criteria, and backwards deletion did not remove exposure metric regardless of significance. Final model may not contain exposure metric if none meet the exposure selection criteria.
  • Tables are all saved as .tex (LaTex format).

“Example-completed” is a completed analysis folder using the same control scripts and data sets as folder “Example1.”

library(PoissonERM)
rm(list = ls(all = TRUE))
folder.dir1 <- "PoissonERM-Example/Example1/" #change the path accordingly
ModelPoisson(pathRunType = folder.dir1,
             user.input = "user-input.r")

PredictionPoisson(pathRunType = getwd(),
                  prediction.input = "prediction-user-input-sim.R",
                  model.RData = "myEnvironment.RData")

ReportPoisson(pathRunType = getwd(),
              model.RData = "myEnvironment.RData",
              file.name = "Report_with_pred.Rmd")


rm(list = ls(all = TRUE))
folder.dir2 <- "PoissonERM-Example/Example2/" #change the path accordingly
ModelPoisson(pathRunType = folder.dir2,
             user.input = "user-input.r")

ReportPoisson(pathRunType = getwd(),
              model.RData = "myEnvironment.RData",
              file.name = "Report_no_pred.Rmd")

Running this script will perform the complete statistical analysis and generate an .Rmd report (which is ready to knit) with all the details, results, predictions, and conclusions for each example.