# sdist - statistical distribution functions

## Motivation

For many tasks in statistical hypothesis testing, it is necessary to find the ordinate value where the cumulative distibution function reaches a particular value (inverse of the CDF). These functions are available in Matlab's stats toolbox, but to allow users without this toolbox to use NeuroElf, freely available code has been edited and put into one compound function, `sdist`

.

## Function reference ('help sdist')

sdist - statistics distributions
FORMAT: d = sdist(type, variate, df1 [, df2 [, pin]])
Input fields:
type either of 'betacdf', 'betainv', 'betapdf',
'fcdf', 'finv', 'fpdf', 'tcdf', 'tinv', 'tpdf'
variate variate (or p-value)
df1, df2 d.f. (or other required parameter)
pin logical flag, inverse from 0.9 to 0.1 logic
Output fields:
d determined value of requested distribution function

## Usage examples

find the value required to threshold a t-map with 25 degrees of freedom at p<0.005 (uncorr.):

sdist('tinv', 0.995, 25)

find the value required to threshold an F-map with (3, 20) degrees of freedom at p<0.01 (uncorr.):

sdist('finv', 0.99, 3, 20)

find out if a given t-statistic (3.314, df = 115) is enough to meet a specific alpha criterion (0.001):

sdist('tcdf', 3.314, 115) >= 0.999