# DetectionTheory

`DetectionTheory.jl`

is a Julia package to compute signal detection theory measures. Signal detection theory (SDT) is commonly used in psychophysics to quantify the performance of an observer in a variety of tasks. `DetectionTheory.jl`

includes functions to compute *d'* for the following tasks:

- ABX
- Multiple alternatives forced choice
- Odd-One-Out with 3 response alternatives (also known as oddity, or triangular method)
- Same-Different
- Yes-No

Most of the functions have been ported from the psyphy R package.

# Installation and Usage

`DetectionTheory`

can be installed using:

```
Pkg.add("DetectionTheory")
```

once the package is installed, to access the functions in the module you can type:

```
using DetectionTheory
```

A complete description of each function is given in the Function Reference section. Information on individual functions can also be obtained using the Julia help system:

```
?dprimeABX
?dprimeSD
```

A few usage examples for `DetectionTheory`

functions are given in the next section.

## Examples

Compute *d'* for an ABX task for an observer with a hit rate of 0.8 and a false alarm rate of 0.4. If we assume that the observer is following a differencing strategy, we can compute *d'* with:

```
dprimeABX(0.8, 0.4, "diff")
```

```
1.7627692904717474
```

if we assume that the observer is using an independent observations strategy instead, we can compute *d'* with:

```
dprimeABX(0.8, 0.4, "IO")
```

```
1.5697504400191788
```

*d'* for the same-different and odd-one-out tasks can also be computed for either the differencing, or the independent observations strategies. For an observer with a hit rate of 0.7 and a false alarm rate of 0.2 in the same-different task:

```
dprimeSD(0.7, 0.2, "diff") #differencing strategy
dprimeSD(0.7, 0.2, "IO") #independent observations strategy
```

```
2.120261690763577
```

for an observer with a proportion of correct responses of 0.7 in the odd-one-out task:

```
dprimeOddity(0.7, "diff") #differencing strategy
dprimeOddity(0.7, "IO") #independent observations strategy
```

```
2.1012488567369276
```

To compute *d'* in a Yes-No task for an observer with a hit rate of 0.6 and a false alarm rate of 0.3:

```
dprimeYesNo(0.6, 0.3)
```

```
0.7777476158438406
```

To compute the *d'* value corresponding to a proportion of correct responses of 0.75 in a 2-alternatives forced choice task:

```
dprimeMAFC(0.75, 2)
```

```
0.9538725524089406
```

for a 3-alternatives forced choice task:

```
dprimeMAFC(0.75, 3)
```

```
1.433830587497066
```