pecon.stats.std#

pecon.stats.std(x, ddof=1)#

Compute the standard deviation of a dataset.

The standard deviation is the square root of the variance and represents dispersion in the same units as the original data.

Parameters:
  • x (array-like) – One-dimensional sequence of numerical values.

  • ddof (int, optional) – Delta degrees of freedom. Use ddof=0 for population standard deviation and ddof=1 for sample standard deviation.

Returns:

The standard deviation of the data.

Return type:

float

Notes

The value of ddof must satisfy 0 <= ddof < N, where N is the number of observations. Otherwise, a ValueError is raised.

Examples

>>> from pecon import stats
>>> x = [2, 4, 6, 8]
>>> std = stats.std(x, ddof=1)
>>> print(f"std = {var}")
std = 2.581988897471611