# sample autocovariance function vs autocovariance function

What is the difference between both functions? I have been reading, but I cannot see the difference. I suppose that the sample autocovariance function is the estimation of the autocovariance function. When I plot it in R using functions from the library itsmr, I don´t which is which.

Maybe one autocovariance function is theoretical, but we estimate it with the sample autocovariance function.

Maybe one autocovariance function is theoretical, but we estimate it with the sample autocovariance function.

Yes, that's correct. One is based on random data, and the other is theoretical and based on properties of the true model along with its true parameters.

You don't tell us which function you're using in that package, but you can calculate both sample and theoretical autocorrelations in R. Below is a demonstration. Notice that if you re-generate the fake_data, you will get different data, and thus different sample autocorrelations. However, as long as you do not change the true model (an ARMA(2,2) in this case), the theoretical acf will not change.

fake_data <- arima.sim(n = 63, list(ar = c(0.8897, -0.4858), ma = c(-0.2279, 0.2488)),
sd = sqrt(0.1796))

acf(fake_data) #sample acf plot
lines(0:17, ARMAacf(ar = c(0.8897, -0.4858), ma =  c(-0.2279, 0.2488), lag.max = 17))  #overlay true


In the itsmr package, which I try not to use whenever I can, the theoretical autocovariance (not autocorrelation) function is calculated by aacvf, while the sample one is calculated by acvf.

• I was using the function acf. For example with the autoregressive model: ar2 <- specify(ar = c(1, -0.9), ma = 0, sigma2 = 1) yk <- sim(ar2, 1000) acf(yk, type = "covariance") acf(yk, type = "partial") – Boris Jan 9 '18 at 23:53
• acf(yk, type = "covariance"), and acf(yk, type = "partial")  are both sample, yeah. The second one is the sample partial autocorrelation, though – Taylor Jan 10 '18 at 14:58