MathU for iPhoneCreative Creek, LLC

MathU™ RPN 2.2 for iPhone
Documentation

Statistics Functions

The statistical functions accumulate sums based on the values in the x and y stack registers. These sums are used to compute the mean mean and standard deviation σ or can be accessed directly via RCL. Use CL Σ to reset all the statistical registers to zero before accumulating sums. If you make a mistake keying in the x,y values and after pressing Σ+, re-key the errant values and press Σ− to remove them from the sums. The mean and standard deviation are computed as

with similar equations holding for the y component as well.

Key Function Description Effect on stack
Σ+ stats+ Accumulate x,y

n is the number of sums accumulated so far.

Σ− stats- Remove x,y

n is the number of sums accumulated so far.

RCL Σ+ rcl Recall statistics sums.
mean mean Mean
σ std Standard deviation
CL Σ clstats Clear statistical registers  
N! fact Factorial
RAND rand Random number from 0 to 1.0 (uniformly distributed) or random integer (when in a non-decimal number base)
% % Percent
%T %T Percent of total
%CH % ch Percent change
y,r ye Linear estimate of y and correlation coefficient
x,r xe Linear estimate of x and correlation coefficient

The statistical sums are strored in these registers:

Statistical Register Layout

RCL . n to access the sums in the secondary registers.

Linear Regression

MathU RPN includes two functions to fit linear trend lines to a set of data, y,r and x,r. The first uses the linear trend to estimate x given a value of y, the second uses the linear trend to estimate y given a value of x. Both functions rely on the statistics registers to hold information about the data points.

The functions also return a goodness of fit parameter, called the correlation coefficient r. r will be near 1.0 or -1.0 for data that is accurately described by the linear fit and values near zero for data that does not have a clear linear trend.

The figures below show two situations, one with a linear trend and another that is not very well estimated by a linear trend. The correlation coefficient for each situation is shown.

Linear regression example Linear regression example

To perform a linear regression:

  1. CLΣ to clear the statistics registers

  2. Enter the data points via y ENTER x Σ+

  3. Repeat step 2 for each point in the data set.
  4. To estimate a y value given an x, enter the x value followed by y,r
  5. To estimate an x value given a y value, enter the x value followed by x,r

Determining the trend line parameters

You can use the y,r and x,r functions to determine the equation of the trend line, y = m*x + b:

  1. Enter the data points into the statistics registers as described above.
  2. 0 y,r to determine b by computing the estimated y when x is 0.0
  3. STO 0 to store b in register 0 (in order to remember it)
  4. 1 y,r to estimate value of y when x is 1.0
  5. RCL 0 to compute the slope m.