# Understanding acf plots produced from ccf function in R

#### sak

##### New Member
I am trying to understand the lead-lag relation between two series. So, I used CCF() function from R.

The code is:
Code:
ccf(drop((S_X)),drop((S_Y)))
What does the attached acf plot produced from above code mean? Which one is leading and which one is lagging?

Thanks

#### chetan.apa

##### Member
I am trying to understand the lead-lag relation between two series. So, I used CCF() function from R.

The code is:
Code:
ccf(drop((S_X)),drop((S_Y)))
What does the attached acf plot produced from above code mean? Which one is leading and which one is lagging?

Thanks
The lag k value returned by ccf(x,y) estimates the correlation between x[t+k] and y[t]

#### sak

##### New Member
The lag k value returned by ccf(x,y) estimates the correlation between x[t+k] and y[t]
So, what does your statement mean in terms of negative and positive lags?

#### chetan.apa

##### Member
So, what does your statement mean in terms of negative and positive lags?
For example if you have two series X and Y with n points each(i.e X(1),X(2)...X(n); Y(1),Y(2)...Y(n)). Then lag 0 is the simple correlation.
Lag1 ccf is correlation between..{X(2),X(3),...X(n)} and { Y(1),Y(2)...Y(n-1)}
Similarly lag -1 would be correlation between {X(1),X(2),....X(n-1)} and {Y(2),Y(3),....Y(n)}

I have attached an illustration. Hope it helps!