Statistics.
The postfix complex calculator has facilities to figure simple descriptive statistics, both univariate and bivariate.
stats  univar  

weight n n−1  bivar  
data count 
Some preliminaries:
♦ For univariate calculations, n stands for the number of points, and a_{k} for any individual point.
♦ For bivariate calculations, n represents the number of pairs of points; within each pair, a_{k} is one member and b_{k} the other. It is possible to regard the a_{k}'s as independent variables, and the b_{k}'s as dependent — or vice versa. The letters a and b were chosen to correspond to their data sources, stack registers a and b respectively.
♦ The subscript k varies from 1 to n inclusive.
♦ Each complex number can be broken into real and imaginary parts: a_{k} = u_{k} + iv_{k} and b_{k} = x_{k} + iy_{k}; where u_{k}, v_{k}, x_{k} and y_{k} are real numbers.
♦ The Greek majuscule sigma is used for summation. For instance, the sum of all the a_{k}'s is written Σ a_{k}. In every case, the index of summation runs between 1 and n. Note the difference between Σ (x_{k}^{2}) and (Σ x_{k})^{2}.
♦ The Greek minuscule mu, suitably subscripted, is used for means. For instance μ_{a} is the mean of the a_{k}'s, and μ_{x} is the mean of the x_{k}'s. Often when the statistics of real numbers is discussed, the mean of the a_{k}'s is denoted a̅, but the overbar is also the symbol for complex conjugation, so it is avoided here.
♦ The superscript c is used for complex conjugation: a_{k}^{c} = (u_{k} + iv_{k})^{c} = u_{k} − iv_{k}.
♦ The Greek minuscule sigma, subscripted and squared, is used for variances, which turn out to be real numbers even with complex data. For example, σ_{a}^{2} is the variance of the a_{k}'s. The standard deviation, not directly provided by the calculator, is the nonnegative square root of the variance: for instance, σ_{a} is the standard deviation of the a_{k}'s. Meanwhile, σ_{ab} (not squared) stands for the covariance between the a_{k}'s and b_{k}'s.
♦ Variances and covariances can be weighted according to n or n − 1. If an entire population is measured, n weighting is the usual choice; if only a sample of the population is measured, n − 1 is typically preferred.
♦ In the bivariate case, ρ_{ab} is used for the correlation of the a_{k}'s and b_{k}'s.
♦ An additional feature is that the covariance and correlation between a_{k}'s real and imaginary parts u_{k} and v_{k} are available; similarly between b_{k}'s parts x_{k} and y_{k}. Statistics between radius and angle are not attempted, one reason being that there are multiple plausible ways to define the mean of a set of angles.
♦ Notation aa^{c} denotes the square of the magnitude of a, where magnitude is a synonym for radius, and is a real number. The interpretation is a(a^{c}), not (aa)^{c}. It equals a^{c}a.
Here are the statistical controls.
• clears all statistical data so that a fresh calculation can begin
• enables the univar and bivar radio buttons • does not affect the stack  
weight
n n − 1  • selects n or n − 1 weighting 
data count  • in univariate mode, tells how many points are stored
• in bivariate mode, tell how many pairs of data points are stored 
univar  • selects univariate mode
• disables buttons specific to bivariate mode 
• inserts a data point popped from stack register a
• disables the univar and bivar radio buttons • operates only in univariate mode  
bivar  • selects bivariate mode
• disables buttons specific to univariate mode 
• inserts a pair of data points popped from stack registers a and b
• disables the univar and bivar radio buttons • operates only in bivariate mode 
The following operations produce a result and push it into register a of the stack. To calculate anything, at least two points are required.
mean of the a values  mean of the b values  
variance of the a values  variance of the b values  
variance of a's real parts  variance of b's real parts  
variance of a's imaginary parts  variance of b's imaginary parts  
covariance between a's real and imaginary parts  covariance between b's real and imaginary parts  
correlation between a's real and imaginary parts  correlation between b's real and imaginary parts  
a independent, b dependent  slope of the regression line  slope of the regression line  b independent, a dependent  
bintercept of the regression line  aintercept of the regression line  
covariance between the a and b data sets  correlation between the a and b data sets 
On the buttons, the notation b(a) is to suggest b as a function of a, hence a independent and b dependent. Regression is linear least squares.
Should the mean of a's real parts be required, it can be found as the real part of the mean of the (complex) a values; similarly for the imaginaries; further similarly for the b's.
It is not possible to change between the univariate and bivariate modes while statistical data is stored; this is to prevent the garbling of data.
The calculator employs procedures equivalent to the following "textbook" formulas:
item  n weighting  n − 1 weighting  field  

a mean  μ_{a} = Σ a_{k} ÷ n  complex  
a variance  σ_{a}^{2} = Σ (a − μ_{a}) (a − μ_{a})^{c} ÷ n  σ_{a}^{2} = Σ (a − μ_{a}) (a − μ_{a})^{c} ÷ (n − 1)  real  
a real part variance  σ_{u}^{2} = Σ (u − μ_{u})^{2} ÷ n  σ_{u}^{2} = Σ (u − μ_{u})^{2} ÷ (n − 1)  
a imag part variance  σ_{v}^{2} = Σ (v − μ_{v})^{2} ÷ n  σ_{v}^{2} = Σ (v − μ_{v})^{2} ÷ (n − 1)  
a realimag covariance  σ_{uv} = Σ (u_{k} − μ_{u}) (v_{k} − μ_{v}) ÷ n  σ_{uv} = Σ (u_{k} − μ_{u}) (v_{k} − μ_{v}) ÷ (n − 1)  real  
a realimag correlation  ρ_{uv} = σ_{uv} ÷ (σ_{u}σ_{v})  
b mean  μ_{b} = Σ b_{k} ÷ n  complex  
b variance  σ_{b}^{2} = Σ (b_{k} − μ_{b}) (b_{k} − μ_{b})^{c} ÷ n  σ_{b}^{2} = Σ (b_{k} − μ_{b}) (b_{k} − μ_{b})^{c} ÷ (n − 1)  real  
b real part variance  σ_{x}^{2} = Σ (x − μ_{x})^{2} ÷ n  σ_{x}^{2} = Σ (x − μ_{x})^{2} ÷ (n − 1)  
b imag part variance  σ_{y}^{2} = Σ (y − μ_{y})^{2} ÷ n  σ_{y}^{2} = Σ (y − μ_{y})^{2} ÷ (n − 1)  
b realimag covariance  σ_{xy} = Σ (x_{k} − μ_{x}) (y_{k} − μ_{y}) ÷ n  σ_{xy} = Σ (x_{k} − μ_{x}) (y_{k} − μ_{y}) ÷ (n − 1)  real  
b realimag correlation  ρ_{xy} = σ_{xy} ÷ (σ_{x}σ_{y})  
ab covariance  σ_{ab} = Σ (a_{k} − μ_{a}) (b_{k} − μ_{b})^{c} ÷ n  σ_{ab} = Σ (a_{k} − μ_{a}) (b_{k} − μ_{b})^{c} ÷ (n − 1)  complex  
ab correlation  ρ_{ab} = σ_{ab} ÷ (σ_{a}σ_{b}) 
An equally valid ab covariance definition would have conjugated (a − μ_{a}) rather than (b − μ_{b}). Such a change would have the effect of conjugating the covariance itself, and consequently the correlation. Another way to conjugate the covariance and correlation is to exchange the a and b data sets.
The correlation will have a magnitude that is no greater than one, and will have a magnitude of exactly unity whenever the regression line fits the data perfectly. Note that in the correlation formulas, the σ's are not squared.
The table below gives formulas for the two ab regression lines, which in general do not coincide, but are often close.
slope  s′ = (σ_{ab})^{c} ÷ σ_{a}^{2}  a independent, b dependent  
intercept  t′ = μ_{b} − s′μ_{a}  
regression line  b = t′ + s′a  
slope  s″ = σ_{ab} ÷ σ_{b}^{2}  b independent, a dependent  
intercept  t″ = μ_{a} − s″μ_{b}  
regression line  a = t″ + s″b 
Contrast the conjugation of σ_{ab} in s′ versus the lack of conjugation in s″. Thus the product of s′ and s″ will be a real number.
For reasons of efficiency, some formulas used by the implementation differ from the "textbook" formulas above.
Each time a data item is inserted, the calculator increments the accumulators listed in the table below; not stored is the data item itself.
Internal accumulators all real  
univariate and bivariate  Σ u_{k}  Σ v_{k}  Σ (u_{k}^{2})  Σ (v_{k}^{2})  Σ (u_{k}v_{k})  n 
bivariate only  Σ x_{k}  Σ y_{k}  Σ (x_{k}^{2})  Σ (y_{k}^{2})  Σ (x_{k}y_{k})  
Σ (u_{k} y_{k})  Σ (v_{k} y_{k})  Σ (u_{k} x_{k})  Σ (v_{k} x_{k}) 
Using values in the accumulators, the calculator can produce various statistics on demand, with no need to iterate through every data item. In the table below are formulas for the variances and covariances; the real and imaginary parts of σ_{ab} are given separately for ease of reading.
n weighting  n − 1 weighting  field  

σ_{u}^{2} = Σ (u_{k}^{2}) ÷ n − (Σ u_{k})^{2} ÷ n^{2}  σ_{u}^{2} = Σ (u_{k}^{2}) ÷ (n − 1) − (Σ u_{k})^{2} ÷ (n^{2} − n)  real  
σ_{v}^{2} = Σ (v_{k}^{2}) ÷ n − (Σ v_{k})^{2} ÷ n^{2}  σ_{v}^{2} = Σ (v_{k}^{2}) ÷ (n − 1) − (Σ v_{k})^{2} ÷ (n^{2} − n)  
σ_{a}^{2} = σ_{u}^{2} + σ_{v}^{2}  σ_{a}^{2} = σ_{u}^{2} + σ_{v}^{2}  
σ_{x}^{2} = Σ (x_{k}^{2}) ÷ n − (Σ x_{k})^{2} ÷ n^{2}  σ_{x}^{2} = Σ (x_{k}^{2}) ÷ (n − 1) − (Σ x_{k})^{2} ÷ (n^{2} − n)  real  
σ_{y}^{2} = Σ (y_{k}^{2}) ÷ n − (Σ y_{k})^{2} ÷ n^{2}  σ_{y}^{2} = Σ (y_{k}^{2}) ÷ (n − 1) − (Σ y_{k})^{2} ÷ (n^{2} − n)  
σ_{b}^{2} = σ_{x}^{2} + σ_{y}^{2}  σ_{b}^{2} = σ_{x}^{2} + σ_{y}^{2}  
σ_{uv} = Σ (u_{k}v_{v}) ÷ n − (Σ u_{k}) (Σ v_{k}) ÷ n^{2}  σ_{uv} = Σ (u_{k}v_{k}) ÷ (n − 1) − (Σ u_{k}) (Σ v_{k}) ÷ (n^{2} − n)  real  
σ_{xy} = Σ (x_{k}x_{y}) ÷ n − (Σ x_{k}) (Σ y_{k}) ÷ n^{2}  σ_{xy} = Σ (x_{k}y_{k}) ÷ (n − 1) − (Σ x_{k}) (Σ y_{k}) ÷ (n^{2} − n)  real  

 complex  


The correlations, and the slopes and intercepts of the regression lines, are calculated from these.
These statistics formulas are augmented from those used for real numbers by the TI 59 calculator. They are presented here in detail because very few sources cover regression with complex variables.
The formulas for slope and intercept are consistent with the matrix solution given by whuber:
β̂ = (X^{ct}X)^{−1}X^{ct}z
where:
Although many authors give the corresponding matrix formula for real numbers, whuber is one of the few to develop it for the complex case.