Package 'tmpm'

Title: Trauma Mortality Prediction Model
Description: Trauma Mortality prediction for ICD-9, ICD-10, and AIS lexicons in long or wide format based on Dr. Alan Cook's tmpm mortality model.
Authors: Cody Moore
Maintainer: Cody Moore <[email protected]>
License: GPL-2
Version: 1.0.3
Built: 2024-12-10 06:56:36 UTC
Source: CRAN

Help Index


marcTable, default Lexicon for tmpm 1.0.3

Description

A data.frame containing the master lexicon for the tmpm package. Contains the index of ais, ICD-9, and ICD-10 trauma codes as well as their respective marc weights within the tmpm model separated by body region.

Usage

marcTable

Format

A data frame with 10767 observations on the following 4 variables.

lexi

The trauma code lexicon, a factor with levels ais icdIX icdX.

index

A unique index value for each entry, a factor with 10767 levels.

marc

Marc weights used in the tmpm model. A numeric vector

bodyregion

Body region where the injury occured. A factor with levels 1 2 3 4 5 6 7 8 9 A C E F H S

References

Glance, LG, Osler, TM, Mukamel, DB, et al. TMPM-ICD9 A Trauma Mortality Prediction Model Based on ICD-9-CM Codes. Ann Surg 2009; 249:1032-1039.

Osler, T, Glance, L, Buzas, JS, et al. A Trauma Mortality Prediction Model Based on the Anatomic Injury Scale. Ann surg 2008; 247:1041-1048.

Examples

#  lexi index   marc       bodyregion
#1  ais 110099 -0.06503967          1
#2  ais 110202  0.13577652          1
#3  ais 110402  0.06703821          1
#4  ais 110600  0.12536530          1
#5  ais 110602 -0.01852628          1
#6  ais 110604  0.27072704          1

Trauma Mortality Prediction Model

Description

An R port for the tmpm trauma mortality prediction model using the ICD-9, ICD-10, or AIS lexicon in long or wide format. Based upon the tmpm package created by Alan Cook, MD for STATA

Usage

tmpm(Pdat,ILex = 1,ICs = marcTable,Long = FALSE)

Arguments

Pdat

An R object, usually a data.frame. May come in either a wide or long format. Patient ID's must be present in the first column, followed by the diagnosis column(s) that contain diagnosis codes in either the ICD-9, ICD-10, or AIS lexicon. The wide format may have multiple Dx columns for each patient containing their respective diagnosis codes while the long format should contain 3 columns of patient ID, Dx, and diagnosis code.

ILex

An integer value used to select which lexicon to use for the tmpm analysis. AIS is the default lexicon and may be selected by the entry of 1. The ICD-9 lexicon may be selected by 9, and the ICD-10 may be selected 10.

ICs

An R object, usually a data.frame. The "master" diagnosis lexicon that may contain the diagnosis codes for the ICD-9, ICD-10, and AIS lexicons. This is already included and will default to the obhect marcTable if no other object is specified. Must contain 4 columns containing the lexicon, index, corresponding marc value, and body region value.

Long

A logical object. Allows the user to specify the format of the Pdat object. Default is wide format. Long = TRUE must be specified to analyze data of long format.

Value

The tmpm algorithm will return a data.frame that contains the original dataset in wide format with an added last column containing the calcualted probability of death for each patient.

Note

Uses the Trauma Mortality prediction model created by Turner Osler, MD, MSc and Laurent Glance, MD.

Based upon the tmpm package written in STATA by Alan Cook, MD

Author(s)

Cody Moore

Alan Cook, MD

References

Glance, LG, Osler, TM, Mukamel, DB, et al. TMPM-ICD9 A Trauma Mortality Prediction Model Based on ICD-9-CM Codes. Ann Surg 2009; 249:1032-1039.

Osler, T, Glance, L, Buzas, JS, et al. A Trauma Mortality Prediction Model Based on the Anatomic Injury Scale. Ann surg 2008; 247:1041-1048.

Examples

## To evaluate ICD-9 patient data in wide format

    #inc_key  dx1    dx2 dx3    dx4
  #1 10000007 821.11 822 815.03 823.00
  #2 10011410 881.00 891 822.10 813.42

a <- data.frame(matrix(c(10000007,821.11,822,815.03,823,
          10011410,881,891,822.1,813.42),nrow = 2,byrow = TRUE))
names(a) <- c("inc_key","dx1","dx2","dx3","dx4")
b <- tmpm(a,9)

## If the dataset is in long format

    #inc_key  variable value
  #1 10000007      dx1 821.11
  #2 10011410      dx1 881.00
  #3 10000007      dx2 822.00
  #4 10011410      dx2 891.00
  #5 10000007      dx3 815.03
  #6 10011410      dx3 822.10
  #7 10000007      dx4 823.00
  #8 10011410      dx4 813.42

c <- melt(a,id = "inc_key")
d <- tmpm(c,9,Long = TRUE)