Other statistical functions

Table of contents


Mean

The mean of the input data is calculated using:

\[\overline{x}=\frac{\sum_{i=1}^{n}{x_i}}{n}\]
pystats.mean(x: List[float]) float

Compute the mean of the given data

Example

>>> pystats.mean([1,2,3,4,5])
3.0
Parameters

x (List[float]) – A standard list input.

Returns

The mean of the values in x.


Standard deviation

The standard deviation of the input data is calculated using:

\[s=\sqrt{\frac{\sum_{i=1}^{n}{(x_i - \overline{x})^2}}{n-1}}\]

This function returns the standard deviation of the sample; that is, it returns the unbiased standard deviation.

pystats.sd(x: List[float]) float

Compute the standard deviation of the given data

Example

>>> pystats.sd([1,2,3,4,5])
1.581138
Parameters

x (List[float]) – A standard list input.

Returns

The standard deviation (unbiased) of the values in x.


Variance

The variance of the input data is calculated using:

\[s^2=\frac{\sum_{i=1}^{n}{(x_i - \overline{x})^2}}{n-1}\]

This function returns the variance of the sample; that is, it returns the unbiased variance.

pystats.var(x: List[float]) float

Compute the variance of the given data

Example

>>> pystats.var([1,2,3,4,5])
2.5
Parameters

x (List[float]) – A standard list input.

Returns

The variance (unbiased) of the values in x.