I would like to have the same results using acf()
function and cor()
on a very easy ts. Unfortunately I am not able to. I thought that scalling factor should be $ (n-1)/n $, but it does not look like that. It look like the proper scaling factor is $ n-l/n $ where $ l $ is a lag. Can somebody help me and explain why it is like that?
tsExample <- c(1,2,1,2)
acf(tsExample, plot = FALSE)
cor(tsExample[1:4], tsExample[1:4])
cor(tsExample[2:4], tsExample[1:3])
cor(tsExample[3:4], tsExample[1:2])
cor(tsExample[4:4], tsExample[1:1])
cor(tsExample[1:4], tsExample[1:4])*(3/4)
cor(tsExample[2:4], tsExample[1:3])*(2/3)
cor(tsExample[3:4], tsExample[1:2])*(1/2)
cor(tsExample[1:4], tsExample[1:4])*(4/4)
cor(tsExample[2:4], tsExample[1:3])*(3/4)
cor(tsExample[3:4], tsExample[1:2])*(2/4)