Statistics Registers¶
Implement a set of statistics registers in the style of a pocket calculator.
The available routines are:
def Clear(): clear the stats registers
def Show(): print the contents of the stats registers
def Add(x, y): add an X,Y pair
def Subtract(x, y): remove an X,Y pair
def AddWeighted(x, y, z): add an X,Y pair with weight Z
def SubtractWeighted(x, y, z): remove an X,Y pair with weight Z
def Mean(): arithmetic mean of X & Y
def StdDev(): standard deviation on X & Y
def StdErr(): standard error on X & Y
def LinearRegression(): linear regression
def LinearRegressionVariance(): est. errors of slope & intercept
def LinearRegressionCorrelation(): the regression coefficient
def CorrelationCoefficient(): relation of errors in slope & intercept
see: | http://stattrek.com/AP-Statistics-1/Regression.aspx?Tutorial=Stat |
---|
pocket calculator Statistical Registers, Pete Jemian, 2003-Apr-18
Source code documentation¶
-
class
jldesmear.jl_api.StatsReg.
StatsRegClass
[source]¶ pocket calculator Statistical Registers class
-
Add
(x, y)[source]¶ add an X,Y pair to the statistics registers
Parameters: - x (float) – value to accumulate
- y (float) – value to accumulate
-
AddWeighted
(x, y, z)[source]¶ add a weighted X,Y+/Z trio to the statistics registers
Parameters: - x (float) – value to accumulate
- y (float) – value to accumulate
- z (float) – variance (weight =
1/z^2
) of y
-
Clear
()[source]¶ clear the statistics registers: \(N=w=\sum{x}=\sum{x^2}=\sum{y}=\sum{y^2}=\sum{xy}=0\)
-
CorrelationCoefficient
()[source]¶ relation of errors in slope and intercept
Returns: correlation coefficient Return type: float
-
LinearEval
(x)[source]¶ Evaluate a linear fit at the given value: \(y = a + b x\)
Parameters: x (float) – independent value, x Returns: y Return type: float
-
LinearRegression
()[source]¶ For (x,y) data pairs added to the registers, fit and find (a,b) that satisfy:
\[y = a + b x\]Returns: (a, b) for fit of y=a+b*x Return type: (float, float)
-
LinearRegressionCorrelation
()[source]¶ the regression coefficient
Returns: (corr_a, corr_b) – is this correct? Return type: (float, float) See: http://stattrek.com/AP-Statistics-1/Correlation.aspx?Tutorial=Stat Look at “Product-moment correlation coefficient”
-
LinearRegressionVariance
()[source]¶ est. errors of slope & intercept
Returns: (var_a, var_b) – is this correct? Return type: (float, float)
-
Mean
()[source]¶ arithmetic mean of X & Y
\[(1 / N) \sum_i^N x_i\]Returns: mean X and Y values Return type: float
-
StdDev
()[source]¶ standard deviation on X & Y
Returns: standard deviation of mean X and Y values Return type: (float, float)
-
StdErr
()[source]¶ standard error on X & Y
Returns: standard error of mean X and Y values Return type: (float, float)
-
Subtract
(x, y)[source]¶ remove an X,Y pair from the statistics registers
Parameters: - x (float) – value to remove
- y (float) – value to remove
-