---
title: "Indentifying non-systematic discounting"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Indentifying non-systematic discounting}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup}
library(tempodisco)
```

The Johnson & Bickel criteria are often used to determine whether an individual exhibits "non-systematic" discounting:

```{r child="../man/fragments/j-b-criteria.Rmd"}
```


To check for non-systematic discounting, we first need to fit a "model-free" discount function to our data. Other discount functions are guaranteed monotonically decreasing, meaning the first criterion (non-monotonic discounting) can't ever be met.

```{r}
data("adj_amt_sim")
df <- adj_amt_indiffs(adj_amt_sim)
mod <- td_ipm(df, discount_function = 'model-free')
plot(mod, verbose = F)
```

As we can see, this data meets the first criterion for non-systematicity but not the second:

```{r}
nonsys(mod)
```

We can do the same thing for binary choice data:

```{r}
data("td_bc_single_ptpt")
mod <- td_bcnm(td_bc_single_ptpt, discount_function = 'model-free')
plot(mod, log = 'x', verbose = F)
```

This data meets neither criterion:

```{r}
nonsys(mod)
```
