Pages

Monday, May 26, 2014

Serial correlation techniques


Short-term update: cited in Wikipedia.

This note shows the relationship between two methods, among a few, to get a measure for autocorrelation (serial correlation).  This is the covariability of sequential changes in data, either above or below its overall average.  For example, the following are short series of directions.  They offer a non-parametric sense of essentially positive, zero (i.e., sequential changes are random), and negative autocorrelation, respectively:

- - - - - + + + + +
+ - + + - - + + - -
+ - + - + - + - + -


A future article this summer will study the appearance of autocorrelation in an important, real-world data set (though it exists in many, such as daily weather, stock prices in recent years, one's height during life, etc.)  Students of these empirical data sets should know that autocorrelation makes long-run forecasting more difficult, while it makes short-run forecasting given an initial direction more easy.  For the current note, we will focus primarily on mathematically reconciling two approaches to solving a measure of autocorrelation.  One might think it would be as easy as taking the correlation between the last n-1 data from a sample of n, and the first n-1 data.  So let’s see what this looks like, assuming a substantial n, coupled with a well-behaved (e.g., normally distributed) random variable.

For equation writing ease, we will label the variables here as the following:

X             = first n-1 data of n (in a time series this can be associated w/ time t-1)
Y             = last n-1 data of n (in a time series this can be associated w/ time t)
mX          = average of random variable X
mY          = average of random variable Y
X’            = X - mX (we will think of X' as a residual)
Y’            = Y - mY (we will think of Y' as a residual)


Over a lengthy time series, the univariate characteristics of X and Y are assumed equal, and this will help with the reconciliation of the autocorrelation formulae below.  The Pearson correlation (r) formula is shown here (where s substitutes for σ due to the web log software):

rX,Y        = Cov(X,Y)/(sXsY)
              ~ E[(X-mX )(Y-mY )]/sY2
              ~ [E(XY)-mXmY ]/sY2


Let’s explore theoretical cases of rX,Y, in three limiting scenarios for perfect positive, zero, and perfect negative serial correlation, respectively.  Note that these are ideal scenarios only; we generally do not actually have all three shown in practice.

Where X=Y,
[E(XY)-mXmY ]/sY2            = [E(Y2)-mY2 ]/[E(Y2)-mY2 ]                           = 1

Where X is independent of Y,
[E(XY)-mXmY ]/sY2            = [mXmY -mXmY]/sY2                                    = 0

Where X=-Y,
[E(XY)-mXmY ]/sY2            = [-E(Y2)+mY2 ]/[E(Y2)-mY2 ]                        = -1


Now let's state that the Durbin-Watson (d) statistic looks at residuals, so let’s see how rX,Y would look in a similar limiting case.  And then we’ll reconcile this set-up with d itself.

Cov(X’,Y’)/(sX’sY’)            ~ E(X’Y’)/sY’2

Where X’=Y’,
Cov(X’,Y’)/(sX’sY’)            ~ [E(Y’2) -mY’2]/[E(Y’2)-mY’2]                           = 1

Where X’ is independent of Y’,
Cov(X’,Y’)/(sX’sY’)            ~ E[X’Y’]/sY’2                                                     = 0

Where X’=-Y’,
Cov(X’,Y’)/(sX’sY’)            ~ [-E(Y’2) +mY’2]/[E(Y’2)-mY’2]                        = -1


What we learn from the formulas above is that we could essentially collapse the rX,Y formula to this expression using residuals: E(X’Y’)/sY’2.  However, the theoretical d format has serial correlation of a range from -1 to 1, inversely mapped to a range from 4 to 0.  This can see this if we multiply the E(X’Y’)/sY’2 expression by -2.  This now maps to a range from 2 to -2.  So we then add 2, and now we get the desired mapped range from 4 to 0:

-2[E(X’Y’)/sY’2]+2     = -2E(X’Y’)/[E(Y’2)-mY’2]+2
                                     = -2E(X’Y’)/E(Y’2)+2
                                     = [-2E(X’Y’)+2E(Y’2)]/E(Y’2)
                                     = [-2E(X’Y’)+E(Y’2)+ E(X’2)]/E(Y’2)
= E(Y’-X’)2/E(Y’2)
~ Σ(Y’-X’)2Y’2
~ d


So while Pearson and Durbin-Watson look very different, what we have just now shown is that we can easily and linearly, map back and forth between these two mathematical techniques for serial correlation!  The basic method one would employ in practice depends slightly on how one's data is presented, how one wants to describe the autocorrelation, what analytical software formula libraries are available, and what level of down-stream analysis may also need to be performed.  

The application of correlation also has interesting connections to least-square regression properties, which is used for factor analysis in many fields.  For example it should be noted for econometricians generally, that the interpretation of market risk beta (β) has its roots in rX,M.  Where here we can think of M as the concurrent market variable.  The square of is CovX,M2/(sXsM)2, which is loosely bounded in a proportional range between 0%, and 100%.  We can follow the square formula below to see how these components are connected with one another:

CovX,M2/(sXsM)2        = CovX,M2/(sX2sM2)           
                                     = (CovX,M/sM2) * CovX,M/sX2            
β * CovX,M/sX2


As a reminder, other mathematical formula descriptions can be easily found using the search bar (on the top of this web log).  

1 comment: