I estimate the linear regression model:
$Y = X\beta + \varepsilon$
where $y$ is an ($n \times 1$) dependent variable vector, $X$ is an ($n \times p$) matrix of independent variables, $\beta$ is a ($p \times 1$) vector of the regression coefficients, and $\varepsilon$ is an ($n \times 1$) vector of random errors.
I want to estimate the covariance matrix of the residuals. To do so I use the following formula:
$Cov(\hat{\varepsilon}) = \sigma^2 (I-H)$
where $\hat{\varepsilon}=Y-X\hat{\beta}$, $\sigma^2$ is estimated by $\hat{\sigma}^2 = \frac{e'e}{n-p}$, $I$ is an identity matrix, and $H = X(X'X)^{-1}X'$ is a hat matrix (see Kutner, 2005).
However, in some source I saw that the covariance matrix of the residuals is estimated in other way. The residuals are assumed to follow $AR(1)$ process:
$\varepsilon_t = \rho \varepsilon_{t-1} + \eta_t$
where $E(\eta) = 0$ and $Var({\eta}) = \sigma^2_{0}I$.
The covariance matrix is estimated as follows
$Cov(\varepsilon) = \sigma^2 \begin{bmatrix} 1 & \rho & \rho^2 & ... & \rho^{n-1}\\ \rho & 1 & \rho & ... & \rho^{n-2} \\ ... & ... & ... & ... & ... \\ \rho^{n-1} & \rho^{n-2} & ... & ... & 1 \end{bmatrix}$
where $\sigma^2 = \frac{1}{1-\rho^2}\sigma^2_0$
My question is are there two different specifications of the covariance matrix of residuals or these are somehow connected with each other?