# Thread: Effective DoF with lag1 autocorrelated data...how to actually incorporate ?

1. ## Effective DoF with lag1 autocorrelated data...how to actually incorporate ?

Hi all,

I have some time series data that is auto-correlated, and I am trying to account for in my correlation analysis. I have found out how to calculate the effective DoF based on Bretherton et al. (1999), which is:

DoFeff = N * ((1-(r1*r2)) / ((1+(r1*r2)) , eq. 1

where r1 and r2 are the first order autocorrelation coefficients for the two variables. My main question is how exactly do I account for this in my analysis? In correlation, the DoF is pairs-2, so for a simple bivariate correlation with two variables, there is 0 DoF. Now if I do regression this is different again, and I get t values that are influenced by DoF that I can use to assess the significance of the correlation coefficients. I worked out the DoF_eff and used that to assess significance based on t-values that SPSS gave me in the linear regression output, but I guess that is probably pointless as the t-values in the regression output are based on the DoF in the model ( n-1 ).

But, how can I use the information from eq. 1 in a statistical package? I have access to Matlab, SPSS, Minitab and Origin. I am thinking that I may have to do something with ARIMA...but I honestly am not sure. Any help would be greatly appreciated!

The Bretherton et al. (1999) paper is: "The Effective Number of Spatial Degrees of Freedom of a Time-Varying Field" (section 5).

2. ## Re: Effective DoF with lag1 autocorrelated data...how to actually incorporate ?

Hi, one possible way to account for temporal autocorrelation (using R) is the following. Assume that Y is your outcome variable and X and Z are predictors (if you want to make a simple correlation between two variables X and Y, just use one of them as predictor and one of them as outcome).

(0) Sort your dataframe chronologically in time

(1) you formulate your regression model:

>install.packages("nlme")
>library(nlme)
>model <- lme(Y ~ X+Z, data = Data)

(2) you check if the residuals of the regression model are autocorrelated (for interpretation of these plot look in the internet or plot your results here):

>acf(resid(model))
>pacf(resid(model))

(3) if residuals are autocorrelated, include an appropriate autocorrelation structure (in the simplest case as shown below: autoregressive order 1 (AR1)):

>modelAR1 <- lme(Y ~ X+Z, data = Data,corr = corARMA(p = 1, q = 0))

indeed, this type of model is called ARMA model

(4) show and interpret your results:

>summary(modelAR1)

3. ## The Following User Says Thank You to mmercker For This Useful Post:

GretaGarbo (06-18-2016)

4. ## Re: Effective DoF with lag1 autocorrelated data...how to actually incorporate ?

Hi, my sincerest thanks for your reply! I have the issue solved

 Tweet

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts