Running Variance

Just in mid of the code wanted to find the Running Variance, just as habit typed and found not so good links.

1/N*[sum(i=1:N-1, Xi*Xi’) + X*X’] – (1/N^2)*[ sum(i=1:(N-1), Xi) + X][ sum(i=1:(N-1), Xi) + X]’

Matlab code for calculating the running Variance is as follow

%updating Mean

newMean = (newMean*(N-1) + X)/N;

sumOfSq = sumOfSq*(N-1)  + X*X';

covMat =  (1/N)*sumOfSQ - newMean*newMean'

Externally there are few links that are worth reading

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

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: