API Documentation#
Statistics of list of (x, y) pairs from calculator-style summation registers.
source code#
Statistics of list of (x, y) pairs from calculator-style summation registers.
mean, standard deviation, max, min of x & y
linear regression & correlation coefficient
peak analysis: centroid and width of x weighted by y
Summation registers in the style of a pocket calculator. |
References:
“Engineering Statistics with a Programmable Calculator”, William Volk, 1982, McGraw-Hill Companies, New York, ISBN 10: 007067552, ISBN 13: 9780070675520.
- class pysumreg.sum_registers.SummationRegisters[source]#
Summation registers in the style of a pocket calculator.
Operations
clear
()Clear the \(\sum{}\) summation registers.
add
(x, y)\(\sum{+}\): Add \((x, y)\) ordered pair to the registers.
subtract
(x, y)\(\sum{-}\): Subtract \((x, y)\) ordered pair from the registers.
to_dict
([use_registers])Return all statistics as dictionary.
Statistical Parameters
Average of \(x\) values.
Average of \(y\) values.
Standard deviation of \(x\) values.
Standard deviation of \(y\) values.
Linear Parameters
First order term (\(b_1\)) in linear fit of \((x,y)\).
Zero order term (\(b_0\)) in linear fit of \((x,y)\).
Regression correlation coefficient (\(r\)) of \((x, y)\).
linear_y
(x)Compute \(\hat{y}\) given \(x\) using slope and intercept.
Peak Parameters
Centroid (\(x_c\)) of \((x, y)\).
The y-weighted variance (\(\sigma_c^2\)) of \((x, y)\).
- property centroid#
Centroid (\(x_c\)) of \((x, y)\).
\[x_c = { \sum{x y} \over \sum{y} }\]Regardless of the input \((x, y)\) signal modality (single peak, multiple peaks, no peaks at all), it is possible to estimate the center (centroid, \(x_c\)) and width (\(2\sigma\)) of the \(x\) values assuming the \(y\) values are their associated weights. The center should fall between the minimum and maximum given \(x\) values.
See:
sigma()
- property correlation#
Regression correlation coefficient (\(r\)) of \((x, y)\).
\[r = {{n\sum{xy} - \sum{x}\sum{y}} \over \sqrt{(n\sum{x^2}-\sum{x}\sum{x}) (n\sum{y^2}-\sum{y}\sum{y})}}\]
- property intercept#
Zero order term (\(b_0\)) in linear fit of \((x,y)\).
\[y = b_0 + b_1 x\]\[b_0 = {{\sum{y} - b_1\sum{x}} \over n}\]See:
slope()
,linear_y()
- linear_y(x)[source]#
Compute \(\hat{y}\) given \(x\) using slope and intercept.
\[\hat{y} = b_0 + b_1 x\]See:
intercept()
,slope()
- property mean_x#
Average of \(x\) values.
\[\bar{x} = {\sum{x} \over n}\]
- property mean_y#
Average of \(y\) values.
\[\bar{y} = {\sum{y} \over n}\]
- property sigma#
The y-weighted variance (\(\sigma_c^2\)) of \((x, y)\).
\[\sigma_c^2 = {\sum{y{(x-x_c)}^2} \over \sum{y}}\]Regardless of the input \((x, y)\) signal modality (single peak, multiple peaks, no peaks at all), it is possible to estimate the center (centroid, \(x_c\)) and width (\(2\sigma_c\)) of the \(x\) values assuming the \(y\) values are their associated weights. The sigma should be less than the span of the \(x\) values.
See:
centroid()
- property slope#
First order term (\(b_1\)) in linear fit of \((x,y)\).
\[y = b_0 + b_1 x\]\[b_1 = {{n\sum{xy} - \sum{x}\sum{y}} \over {n\sum{x^2} - \sum{x}\sum{x}}}\]See:
intercept()
,linear_y()
- property stddev_x#
Standard deviation of \(x\) values.
\[\sigma_x^2 = {{\sum{x^2} - \bar{x}\sum{x}} \over {n-1}}\]
- property stddev_y#
Standard deviation of \(y\) values.
\[\sigma_y^2 = {{\sum{y^2} - \bar{y}\sum{y}} \over {n-1}}\]