Further Calculator Statistics

This is further to my post on calculator statistics.

If the calculator also stores the six values \Sigma x^3, \Sigma x^4 and \Sigma x^2y, then it can calculate the linear regression to a parabola.

The initial state (for the empty data set) has:

\Sigma x^3 = \Sigma x^4 = \Sigma x^2y = 0.

Given a new point \langle f,x,y \rangle where f is the frequency and/or weight, these values are updates thus:

\Sigma x^3 :+= f x^3
\Sigma x^4 :+= f x^4
\Sigma x^2y :+= f x^2 y

Best fit (minimum square vertical offsets) parabola or quadratic y = c x^2 + b x + a:

c = c_{\rm num}/d, b=b_{\rm num}/d and a=a_{\rm num}/d;

where

c_{\rm num} = (+ \Sigma x \Sigma x^3 - (\Sigma x^2)^2 ) \Sigma y
+ (- n \Sigma x^3 + \Sigma x \Sigma x^2) \Sigma xy
+ (+ n \Sigma x^2 - (\Sigma x)^2 ) \Sigma x^2y;

b_{\rm num} = (- \Sigma x \Sigma x^4 + \Sigma x^2 \Sigma x^3) \Sigma y
+ (+ n \Sigma x^4 - (\Sigma x^2)^2 ) \Sigma xy
+ (- n \Sigma x^3 + \Sigma x \Sigma x^2) \Sigma x^2y;

a_{\rm num} = (+ \Sigma x^2 \Sigma x^4 - (\Sigma x^3)^2 ) \Sigma y
+ (- \Sigma x \Sigma x^4 + \Sigma x^2 \Sigma x^3) \Sigma xy
+ (+ \Sigma x \Sigma x^3 - (\Sigma x^2)^2 ) \Sigma x^2y;

d = n \Sigma x^2 \Sigma x^4 - n (\Sigma x^3)^2 - (\Sigma x)^2 \Sigma x^4 + 2 \Sigma x \Sigma x^2 \Sigma x^3 - (\Sigma x^2)^3.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: