# Comparing discounting across different discount functions

    library(tempodisco)

By default, `tempodisco` allows you to fit models using a variety of discount functions. However, this raises the question of how you can quantify and compare overall rates of discounting between two different discount functions. For example, it would be a mistake to directly compare \(k\) values from the scaled exponential (Laibson, 1997) and nonlinear-time exponential (Ebert & Prelec, 2007) discount functions, since these mean different things. Instead, we need a model-agnostic measure of discounting. One of these is the ED50 (Yoon & Higgins, 2008), which is the delay at which the discount function returns a value of 0.5, i.e. the delay at which a delayed reward’s value is 50% of its face value. This can be computed using the `ED50()` function:

    data("td_bc_single_ptpt")
    mod1 <- td_bcnm(td_bc_single_ptpt, discount_function = 'scaled-exponential')
    mod2 <- td_bcnm(td_bc_single_ptpt, discount_function = 'nonlinear-time-hyperbolic')

    k1 <- coef(mod1)['k']
    k2 <- coef(mod2)['k']
    cat(sprintf('Percentage difference in k values: %.2f%%\n', 100*abs((k1 - k2)/((k1 + k2)/2))))
    #> Percentage difference in k values: 156.91%

    ed501 <- ED50(mod1)
    ed502 <- ED50(mod2)
    cat(sprintf('Percentage difference in ED50 values: %.2f%%\n', 100*abs(ed501 - ed502)/((ed501 + ed501)/2)))
    #> Percentage difference in ED50 values: 11.20%

Another option is to use the model-based area under the curve (AUC) with the `AUC` function:

    auc1 <- AUC(mod1)
    auc2 <- AUC(mod2)
    cat(sprintf('Percentage difference in AUC values: %.2f%%\n', 100*abs(auc1 - auc2)/((auc1 + auc2)/2)))
    #> Percentage difference in AUC values: 16.75%

This latter method has the advantage of being well-defined for the “model-free” discount function, whereas the ED50 is not.