Chapter 2 Data load
require(plyr)
require(stringr)
require(mgcv)
require(knitr)
We are using RHC data (Connors et al. 1996) as an example.
load("data/rhcX.RData")
kable(head(rhc))
death | swang1 | age | sex | race | edu | income | ninsclas | cat1 | das2d3pc | dnr1 | ca | surv2md1 | aps1 | scoma1 | wtkilo1 | temp1 | meanbp1 | resp1 | hrt1 | pafi1 | paco21 | ph1 | wblc1 | hema1 | sod1 | pot1 | crea1 | bili1 | alb1 | resp | card | neuro | gastr | renal | meta | hema | seps | trauma | ortho | cardiohx | chfhx | dementhx | psychhx | chrpulhx | renalhx | liverhx | gibledhx | malighx | immunhx | transhx | amihx | id |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 70.25098 | Male | white | 12.000000 | Under $11k | Medicare | COPD | 23.50000 | No | Yes | 0.6409912 | 46 | 0 | 64.69995 | 38.69531 | 41 | 10 | 124 | 68.0000 | 40 | 7.359375 | 22.0976562 | 58.00000 | 145 | 4.000000 | 1.1999512 | 1.0097656 | 3.500000 | Yes | Yes | No | No | No | No | No | No | No | No | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
1 | 1 | 78.17896 | Female | white | 12.000000 | Under $11k | Private & Medicare | MOSF w/Sepsis | 14.75195 | No | No | 0.7549996 | 50 | 0 | 45.69998 | 38.89844 | 63 | 38 | 137 | 218.3125 | 34 | 7.329102 | 28.8984375 | 32.50000 | 137 | 3.299805 | 0.5999756 | 0.6999512 | 2.599609 | No | No | No | No | No | No | No | Yes | No | No | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 2 |
0 | 1 | 46.09198 | Female | white | 14.069916 | $25-$50k | Private | MOSF w/Malignancy | 18.13672 | No | Yes | 0.3169999 | 82 | 0 | 0.00000 | 36.39844 | 57 | 40 | 130 | 275.5000 | 16 | 7.359375 | 0.0499954 | 21.09766 | 146 | 2.899902 | 2.5996094 | 1.0097656 | 3.500000 | No | Yes | No | No | No | No | No | No | No | No | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
1 | 0 | 75.33197 | Female | white | 9.000000 | $11-$25k | Private & Medicare | ARF | 22.92969 | No | No | 0.4409790 | 48 | 0 | 54.59998 | 35.79688 | 55 | 26 | 58 | 156.6562 | 30 | 7.459961 | 23.2968750 | 26.29688 | 117 | 5.799805 | 1.6999512 | 0.3999634 | 3.500000 | Yes | No | No | No | No | No | No | No | No | No | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 |
1 | 1 | 67.90997 | Male | white | 9.945259 | Under $11k | Medicare | MOSF w/Sepsis | 21.05078 | Yes | No | 0.4369998 | 72 | 41 | 78.39996 | 34.79688 | 65 | 27 | 125 | 478.0000 | 17 | 7.229492 | 29.6992188 | 24.00000 | 126 | 5.799805 | 3.5996094 | 1.0097656 | 3.500000 | No | Yes | No | No | No | No | No | No | No | No | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
0 | 0 | 86.07794 | Female | white | 8.000000 | Under $11k | Medicare | COPD | 17.50000 | No | No | 0.6650000 | 38 | 0 | 54.89999 | 39.19531 | 115 | 36 | 134 | 184.1875 | 68 | 7.299805 | 18.0000000 | 30.50000 | 138 | 5.399414 | 1.3999023 | 1.0097656 | 3.099609 | Yes | No | No | No | No | No | No | No | No | No | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
ls()
## [1] "Er" "exposure" "Oformula" "outcome" "rhc" "RHScov" "vars" "Yr"
set.seed(1)
We will use this data to show how to implement a plasmode simulation (J. M. Franklin et al. 2014) in a binary exposure / outcome data
References
Connors, Alfred F, Theodore Speroff, Neal V Dawson, Charles Thomas, Frank E Harrell, Douglas Wagner, Norman Desbiens, et al. 1996. “The Effectiveness of Right Heart Catheterization in the Initial Care of Critically III Patients.” Jama 276 (11): 889–97. https://tinyurl.com/Connors1996.
Franklin, J. M., S. Schneeweiss, J. M. Polinski, and J. A. Rassen. 2014. “Plasmode Simulation for the Evaluation of Pharmacoepidemiologic Methods in Complex Healthcare Databases.” Computational Statistics & Data Analysis 72: 219–26.