prep_log_AUC: Calculate log x_axis values for AUClog

View source: R/log_AUC.R

prep_log_AUCR Documentation

Calculate log x_axis values for AUClog

Description

Calculate log x_axis values for AUClog

Usage

prep_log_AUC(
  dat,
  x_axis,
  log_base = 2,
  type = "adjust",
  correction = 1,
  dec_offset = TRUE
)

Arguments

dat

Discounting data tibble. AUC_zeroes should be run first if zero values on the x_axis will need to be included.

x_axis

Delays/probabilities/social distance variable

log_base

Base of the logarithm

type

Type of correction to handle 0 values on x_axis. Acceptable values are "corr"., "adjust", and "IHS". "Corr" adds a set value to each x_axis value and then takes the log of those values. "Adjust" implements increasing the x_axis values by the average difference between the log values on the x_axis. "IHS" calculates the inverse hyperbolic sine, which is different than the logarithm but is highly correlated with log transformed values. The IHS transformation does not require corrections

correction

If type == "corr" this value is what is added to the x_axis prior to taking the log values.

dec_offset

If TRUE, offsets the log x_axis values if the lowest non-zero x_axis value is a decimal. This calculation is preferred because if x_axis values are negative then the log values will be negative. The negative log values can cause inconsistencies in how AUC is calculated.

Value

Original data frame (a tibble) that includes an appended column with log scale version of x_axis

Correction types for handling zero x-axis values

"Corr" adds a set correction value to each x_axis value and then takes the log of those values. "Adjust" implements increasing the x_axis values by the average difference between the log values on the x_axis. "IHS" calculates the inverse hyperbolic sine for the x_axis, which is different than the logarithm but is highly correlated with log transformed values. The IHS transformation does not require adjustments because IHS(0) == 0.

Examples


prep_log_AUC(
  dat = examp_DD,
  x_axis = "delay_months",
  log_base = 10,
  dec_offset = TRUE,
  type = "adjust",
  correction = 1
)

discAUC documentation built on March 31, 2023, 5:26 p.m.