Skip to contents

This function takes a 2x2 matrix and calculates the ratio of the difference between two numerator and denominator states. This function is intended to calculate the ICER between two defined strategies or interventions in a health economics assessment.

Usage

icercalc(data, rev = c("neither", "rows", "columns", "both"))

Arguments

data

An object containing a 2x2 matrix of exactly 4 numerical values

rev

An argument specifying the order of the matrix inputted into the "data" argument. Includes "rows" (reverses order of rows), "columns" (reverses columns) or "both" (reverses both). Set to "neither" as default.

Value

The matrix used to calculate the output after the "rev" argument has been applied and a numeric output.

Details

This function expects the "data" argument to list an object storing a 2x2 matrix containing exactly 4 numerical values. Using labels as expected for an ICER calculation, the following structure is expected:

             old     new
cost (ref)   n00     n01
qaly (ref)   n10     n11

The function extracts matrices outputs for the calculation relative to the defined reference values. If the matrix is not in the desired format, the "rev" argument can be used to switch the order of the rows, columns or both. It is set to "neither" as default and will calculate the ICER using the current order of the values presented.

Examples


icer_table <- matrix(c(24, 12, 8, 6), nrow = 2, ncol = 2, byrow = TRUE)

# Calculating ICER with the native matrix as inputted with the default rev = "neither"
icercalc(data = icer_table)
#> [1] "Modified matrix:"
#>      [,1] [,2]
#> [1,]   24   12
#> [2,]    8    6
#> 
#> Incremental Cost:
#>  -12 
#> Incremental QALY:
#>  -2 
#> Incremental cost-effectiveness ratio (ICER):
#>  6 

# Applying a "rev" argument to rearrange the matrix for ICER calculation
icercalc(data = icer_table, rev = "columns")
#> [1] "Modified matrix:"
#>      [,1] [,2]
#> [1,]   12   24
#> [2,]    6    8
#> 
#> Incremental Cost:
#>  12 
#> Incremental QALY:
#>  2 
#> Incremental cost-effectiveness ratio (ICER):
#>  6