>Diff is forward differencing. In R, it’s a difference between i and i+1, but they first organize the data into an array by year, so it really ends up being a difference between month i and month i+12, as I mentioned above. I coded this up myself and got an extremely similar result. (I used the Mauna Loa data which I had on hand, which is slightly different from the global data, so it’s not exactly the same.) It does have the right magnitude.
Ah OK I just saw that Wikipedia has even an entry for the term forward difference
. Sorry I thought this was again some climatologist-specific term.
So you think that the monthly values are e.g. arranged in the rows of a matrix? Is this because of this line ?:
`diff12 <- matrix(rep(NA,n*12),12,n)´
where matrix, rep and NA are again some in-built functions? But then x[ii] looks as if asking for the elements of a tupel not of a matrix.
Is your code in a different computer language? May be I understand that then better.