Learn R Programming

⚠️There's a newer version (3.1.4) of this package.Take me there.

EmpiricalCalibration

EmpiricalCalibration is part of HADES.

Introduction

This R package contains routines for performing empirical calibration of observational study estimates. By using a set of negative control hypotheses we can estimate the empirical null distribution of a particular observational study setup. This empirical null distribution can be used to compute a calibrated p-value, which reflects the probability of observing an estimated effect size when the null hypothesis is true taking both random and systematic error into account, as described in the paper Interpreting observational studies: why empirical calibration is needed to correct p-values.

Also supported is empirical calibration of confidence intervals, based on the results for a set of negative and positive controls, as described in the paper Empirical confidence interval calibration for population-level effect estimation studies in observational healthcare data.

Features

  • Estimate the empirical null distribution given the effect estimates of a set of negative controls.
  • Estimate the calibrated p-value of a given hypothesis given the estimated empirical null distribution.
  • Estimate a systematic error distribution given the effect estimates for a set of negative and positive controls.
  • Estimate the calibrated confidence interval for a given estimate given the systematic error distribution.
  • Estimate a calibrated log likelihood ratio, for use in maximum sequential probability ratio testing (MaxSPRT).
  • Produce various plots for evaluating the empirical calibration.
  • Contains the data sets from the papers for illustration.

Screenshots and examples

data(sccs) #Load one of the included data sets
negatives <- sccs[sccs$groundTruth == 0,] #Select the negative controls
null <- fitNull(logRr = negatives$logRr, seLogRr = negatives$seLogRr) #Fit the null distribution
positive <- sccs[sccs$groundTruth == 1,]  #Select the positive control

#Create the plot above:
plotCalibrationEffect(logRrNegatives = negatives$logRr,
                      seLogRrNegatives = negatives$seLogRr,
                      logRrPositives = positive$logRr,
                      seLogRrPositives = positive$seLogRr,
                      null = null)

#Compute the calibrated p-value:
calibrateP(null = null, logRr = positive$logRr, seLogRr = positive$seLogRr) #Compute calibrated p-value
[1] 0.8390598

Technology

This is a pure R package.

System requirements

Requires R (version 3.1.0 or newer).

Installation

In R, use the following commands to install the latest stable version from CRAN:

install.packages("EmpiricalCalibration")

To install the latest development version directly from GitHub, use:

install.packages("remotes")
library(remotes)
install_github("ohdsi/EmpiricalCalibration", ref = "develop")

User Documentation

Documentation can be found on the package website.

PDF versions of the documentation is also available:

Support

  • Developer questions/comments/feedback: OHDSI Forum
  • We use the GitHub issue tracker for all bugs/issues/enhancements

Contributing

Read here how you can contribute to this package.

License

EmpiricalCalibration is licensed under Apache License 2.0

Development

This package has been developed in RStudio.

Development status

This package is ready for use.

Copy Link

Version

Install

install.packages('EmpiricalCalibration')

Monthly Downloads

1,511

Version

3.1.3

License

Apache License 2.0

Issues

Pull Requests

Stars

Forks

Maintainer

Martijn Schuemie

Last Published

September 30th, 2024

Functions in EmpiricalCalibration (3.1.3)

caseControl

Odds ratios from a case-control design
compareEase

Compare EASE of correlated sets of estimates
EmpiricalCalibration-package

EmpiricalCalibration: Routines for Performing Empirical Calibration of Observational Study Estimates
cohortMethod

Relative risks from a new-user cohort design
calibrateConfidenceInterval

Calibrate confidence intervals
computeCvPoisson

Compute critical values for Poisson data
evaluateCiCalibration

Evaluate confidence interval calibration
plotCiCalibration

Create a confidence interval calibration plot
plotCiCalibrationEffect

Plot the effect of the CI calibration
computeTraditionalP

Compute the (traditional) p-value
computeCvBinomial

Compute critical values for Binomial data
convertNullToErrorModel

Convert empirical null distribution to systematic error model
fitMcmcNull

Fit the null distribution using MCMC
fitNull

Fit the null distribution
plotMcmcTrace

Plot the MCMC trace
calibrateP

Calibrate the p-value
fitSystematicErrorModel

Fit a systematic error model
plotTrueAndObserved

Plot true and observed values
computeCvPoissonRegression

Compute critical values for Poisson regression data
simulateMaxSprtData

Simulate survival data for MaxSPRT computation
sccs

Incidence rate ratios from Self-Controlled Case Series
plotCalibration

Create a calibration plot
grahamReplication

Relative risks from an adjusted new-user cohort design
simulateControls

Simulate (negative) controls
computeExpectedAbsoluteSystematicError

Compute the expected absolute systematic error
plotExpectedType1Error

Plot the expected type 1 error as a function of standard error
plotForest

Create a forest plot
fitNullNonNormalLl

Fit the null distribution using non-normal log-likelihood approximations
computeTraditionalCi

Compute the (traditional) confidence interval
plotCiCoverage

Create a confidence interval coverage plot
plotErrorModel

Plot the systematic error model
plotCalibrationEffect

Plot the effect of the calibration
southworthReplication

Relative risks from an unadjusted new-user cohort design
calibrateLlr

Calibrate the log likelihood ratio