# library.stat Submodule¶

## Module Summary¶

Interfaces for the NAG Mark 28.6 stat Chapter.

stat - Simple Calculations on Statistical Data

This module covers the following topics:

descriptive statistics and exploratory data analysis;

statistical distribution functions and their inverses;

testing for Normality and other distributions.

naginterfaces.library.examples.stat :

This subpackage contains examples for the stat module. See also the Examples subsection.

## Functionality Index¶

Descriptive statistics / Exploratory analysis

summaries

frequency / contingency table

one variable: frequency_table()

two variables, with and Fisher’s exact test: contingency_table()

mean, variance, skewness, kurtosis (one variable)

mean, variance, sums of squares and products (two variables): summary_2var()

median, hinges / quartiles, minimum, maximum: five_point_summary()

quantiles

approximate

large data stream of fixed size: quantiles_stream_fixed()

large data stream of unknown size: quantiles_stream_arbitrary()

unordered vector

rolling window

mean, standard deviation (one variable): moving_average()

Distributions

vectorized deviates: inv_cdf_chisq_vector()

vectorized probabilities: prob_chisq_vector()

Beta

central

deviates

probabilities and probability density function

non-central

binomial

distribution function

Dickey–Fuller unit root test

Durbin–Watson statistic

energy loss distributions

central

non-central

gamma

Hypergeometric

Kolomogorov–Smirnov

Normal

bivariate

multivariate

probabilities: prob_multi_normal()

probability density function

univariate

deviates

probabilities

probability density function

reciprocal of Mill’s Ratio: mills_ratio()

Shapiro and Wilk’s test for Normality: test_shapiro_wilk()

Poisson

distribution function

Student’s

central

non-central

Studentized range statistic

von Mises

central

deviates: inv_cdf_chisq()

probabilities: prob_chisq()

probability of linear combination: prob_chisq_lincomb()

non-central

Scores

Normal scores

Normal scores, ranks or exponential (Savage) scores: ranks_and_scores()

For full information please refer to the NAG Library document

https://www.nag.com/numeric/nl/nagdoc_28.6/flhtml/g01/g01intro.html

## Examples¶

naginterfaces.library.examples.stat.moving_average_ex.main()[source]

Calculate the mean and, optionally, the standard deviation using a rolling window for an arbitrary sized data stream.

>>> main()
naginterfaces.library.stat.moving_average Python Example Results.
Spencer's 15-point moving average for the change in rate of the
Earth's rotation between 1821 and 1850.
Interval         Mean        Std. Dev.
--------------------------------------
[  1, 15]       -427.6           -
[  2, 16]       -332.5           -
[  3, 17]       -337.1           -
[  4, 18]       -438.2           -
[  5, 19]       -604.4           -
[  6, 20]       -789.4           -
[  7, 21]       -935.4           -
[  8, 22]       -990.6           -
[  9, 23]       -927.1           -
[ 10, 24]       -752.1           -
[ 11, 25]       -501.3           -
[ 12, 26]       -227.2           -
[ 13, 27]         23.2           -
[ 14, 28]        236.2           -
[ 15, 29]        422.4           -
[ 16, 30]        604.2           -
Total number of observations: 30
Length of window: 15