Computing model-free area under the curve (AUC)

library(tempodisco)

“Area under the curve” (AUC) is often used as an empirical measure of discounting ((Myerson et al., 2001)[https://doi.org/10.1901/jeab.2001.76-235]). To compute this measure, we first fit a model using the 'model-free' discount function (which identifies indifference points separately at each delay), and then call the AUC function. For example:

# Get data containing indifference points
data("adj_amt_sim")
df <- adj_amt_indiffs(adj_amt_sim)
# Fit model
mod <- td_ipm(df, discount_function = 'model-free')
print(AUC(mod))
#> Defaulting to max_del = 360
#> Assuming an indifference point of 1 at delay 0
#> [1] 0.3333984

To compute the AUC only between certain limits, you can use the min_del and max_del arguments:

print(AUC(mod, min_del = 1, max_del = 100))
#> Assuming an indifference point of 1 at delay 0
#> [1] 0.5558725

For the AUC computed this way, the later indifference points tend to have an outsize influence on the overall measure. To address this, Borges et al. (2016) suggest transforming the delays to a log or ordinal scale. After this transformation, we can re-fit the model and re-compute the AUC. For example, for the log transformation:

df$untransformed_del <- df$del # Save a copy
df$del <- log(df$untransformed_del)
mod <- td_ipm(df, discount_function = 'model-free')
print(AUC(mod))
#> Defaulting to max_del = 5.88610403145016
#> Assuming an indifference point of 1 at delay 0
#> [1] 0.6975516

Similarly, for the ordinal transformation:

df$del <- as.numeric(factor(df$untransformed_del, ordered = T))
mod <- td_ipm(df, discount_function = 'model-free')
print(AUC(mod))
#> Defaulting to max_del = 5
#> Assuming an indifference point of 1 at delay 0
#> [1] 0.5703125

Note that any transformation of the delays must be performed prior to fitting the model. This is because, for the model-free discount function, interpolations between indifference points are linear in the original scale of the data. This is evident in the curved interpolations in the plot below:

df$del <- df$untransformed_del
mod <- td_ipm(df, discount_function = 'model-free')
plot(mod, log = 'x', verbose = F)