This report demonstrates Key Risk Indicator (KRI) analysis for adverse events using the {gsm.kri} package. The examples show how to:
Load required packages and data:
library(gsm.core)
library(gsm.mapping)
library(dplyr)
devtools::load_all()
# Load source data
dm <- gsm.core::lSource$Raw_SUBJ
ae <- gsm.core::lSource$Raw_AE
Generate an Adverse Event Metric using the standard {gsm} workflow:
dfInput <- Input_Rate(
dfSubjects = dm,
dfNumerator = ae,
dfDenominator = dm,
strSubjectCol = "subjid",
strGroupCol = "invid",
strNumeratorMethod = "Count",
strDenominatorMethod = "Sum",
strDenominatorCol = "timeonstudy"
)
dfTransformed <- Transform_Rate(dfInput)
dfAnalyzed <- Analyze_NormalApprox(dfTransformed, strType = "rate")
dfFlagged <- Flag(dfAnalyzed, vThreshold = c(-3, -2, 2, 3))
dfSummarized <- Summarize(dfFlagged)
table(dfSummarized$Flag)
##
## 0 1 2
## 136 8 1
Create an SAE Metric by adding a filter, using pipes for cleaner code:
SAE_KRI <- Input_Rate(
dfSubjects = dm,
dfNumerator = ae %>% filter(aeser == "Y"),
dfDenominator = dm,
strSubjectCol = "subjid",
strGroupCol = "invid",
strNumeratorMethod = "Count",
strDenominatorMethod = "Sum",
strDenominatorCol = "timeonstudy"
) %>%
Transform_Rate() %>%
Analyze_NormalApprox(strType = "rate") %>%
Flag(vThreshold = c(-3, -2, 2, 3)) %>%
Summarize()
table(SAE_KRI$Flag)
##
## 0 1 2
## 138 5 2
Create bar charts to visualize different aspects of the SAE metric:
labels <- list(
Metric = "Serious Adverse Event Rate",
Numerator = "Serious Adverse Events",
Denominator = "Days on Study"
)
# Metric bar chart
gsm.kri::Widget_BarChart(dfResults = SAE_KRI, lMetric = labels, strOutcome = "Metric")
# Score bar chart
gsm.kri::Widget_BarChart(dfResults = SAE_KRI, lMetric = labels, strOutcome = "Score")
# Numerator bar chart
gsm.kri::Widget_BarChart(dfResults = SAE_KRI, lMetric = labels, strOutcome = "Numerator")
Create a scatter plot showing the relationship between metrics with confidence bounds:
dfBounds <- Analyze_NormalApprox_PredictBounds(SAE_KRI, vThreshold = c(-3, -2, 2, 3))
gsm.kri::Widget_ScatterPlot(SAE_KRI, lMetric = labels, dfBounds = dfBounds)
This report demonstrated the {gsm.kri} workflow for adverse event monitoring:
The methodology enables systematic monitoring of adverse event rates across study sites to identify potential safety signals.
Generated with {gsm.kri} version 1.3.2