I am estimating a VAR model in STATA. The model is as follows:

Code:
var potgap defl interest, noconstant lags(1/4)
I then output the covariance matrix of the residuals as:

Code:
matrix list e(Sigma)
So far, no problem. But then I try to calculate the covariance matrix more manually using the following code:

Code:
predict res1, residuals equation(#1)
predict res2, residuals equation(#2)
predict res3, residuals equation(#3)
mat accum cov = res1 res2 res3, noconstant deviations
mat cov = cov/274
mat list cov
When doing this, I get a slightly different matrix. The matrix is not very different, but the results vary on the 2nd or 3rd decimal.

I have tried changing the divisor if STATA where to use some different degree of freedom correction, but this just makes the results even more incorrect.

Does anyone know what is causing the difference? Thanks in advance!