STA13824 - Análise de regressão


Interpretação geométrica do estimador MQO



LECON/DEST - UFES

Última atualização: 13 maio, 2025

Alguns resultados da álgebra matricial

Para detalhes sugere-se a consulta das seguintes referências Magnus e Neudecker (2019), Harville (1997), Searle (2017), Greene (2003).

  • Produto interno: Sejam \(\mathbf{x}\), \(\mathbf{y}\) e \(\mathbf{z}\) três vetores de um espaço vetorial \(V\), definido no plano complexo \(\mathbb{C}\). Seja \(\lambda\) um escalar. Define-se o produto interno como uma função \(\langle\cdot, \cdot\rangle:V\times V \longrightarrow \mathbb{C}\), tal que

    1. \(\langle\mathbf{x}, \mathbf{y}\rangle=\overline{\langle\mathbf{y}, \mathbf{x}\rangle}\quad\) (Simetria Hermitiana);

    2. \(\langle\mathbf{x}+\mathbf{y}, \mathbf{z}\rangle=\langle\mathbf{x}, \mathbf{z}\rangle+\langle\mathbf{y}, \mathbf{z}\rangle\quad\) (Distributividade);

    3. \(\langle\lambda\mathbf{x}, \mathbf{y}\rangle=\lambda\langle\mathbf{x}, \mathbf{y}\rangle\quad\) (Homogeneidade );

    4. \(\langle\mathbf{x}, \mathbf{x}\rangle\ge0\). A igualdade é satisfeita see \(\mathbf{x}\) é o vetor nulo.

    No espaço euclideano, o Item 1. é dado por \(\langle\mathbf{x}, \mathbf{y}\rangle=\langle\mathbf{y}, \mathbf{x}\rangle=\sum_{i=1}^nx_iy_i\), onde \(\mathbf{x}=(x_1,x_2,\ldots,x_n)'\) e \(\mathbf{y}=(y_1,y_2,\ldots,y_n)'\).

  • Magnitude de um vetor: Seja \(\mathbf{x}\) um vetor. A magnitude (ou norma) de \(\mathbf{x}\) define-se como

\[\lVert\mathbf{x}\rVert=\sqrt{\langle\mathbf{x}, \mathbf{x}\rangle}=\sqrt{\mathbf{x}'\mathbf{x}}= \sqrt{\sum_{i=1}^nx_i^2}.\] propriedades: Sejam \(\mathbf{x}\) e \(\mathbf{y}\) dois vetores de um espaço vetorial \(V\) e \(\lambda\) um escalar, então

  • \(\lVert\mathbf{x}\rVert\ge0\), \(\lVert\mathbf{x}\rVert=0\) see \(\mathbf{x}=\mathbf{0}\);
  • \(\lVert\lambda\mathbf{x}\rVert=\lambda\lVert\mathbf{x}\rVert\) ;
  • \(\lVert\mathbf{x}+\mathbf{y}\rVert\le\lVert\mathbf{x}\rVert+\lVert\mathbf{y}\rVert.\qquad\) (Desigualdade triangular)
  • Ângulo entre vetores: Sejam \(\mathbf{x}\) e \(\mathbf{y}\) dois vectores de um espaço vectorial com produto interno, então \[\cos\theta=\frac{\langle\mathbf{x},\mathbf{y}\rangle}{\lVert\mathbf{x}\rVert\lVert\mathbf{y}\rVert}.\]

    Em particular, dizemos que \(\mathbf{x}\) e \(\mathbf{y}\) são ortogonais see \(\langle\mathbf{x},\mathbf{y}\rangle=0\) ou, equivalentemente, \(\theta=\frac\pi2\).

  • Desigualdade de Cauchy-Schwarz: A desigualdade garante que, para quaisquer dois vectores \(\mathbf{x}\) e \(\mathbf{y}\) de um espaço vectorial com produto interno, se tem \[\left|\langle\mathbf{x},\mathbf{y}\rangle\right|\le \lVert\mathbf{x}\rVert\lVert\mathbf{y}\rVert.\]

    Tem-se a igualdade, i.e., \(\left|\langle\mathbf{x},\mathbf{y}\rangle\right|=\lVert\mathbf{x}\rVert\lVert\mathbf{y}\rVert\,\), see \(\,\mathbf{x}=\frac{\langle\mathbf{x},\mathbf{y}\rangle}{\langle\mathbf{y},\mathbf{y}\rangle}\mathbf{y}\).

  • Lei do paralelogramo: A lei garante que, para quaisquer dois vectores \(\mathbf{x}\) e \(\mathbf{y}\) de um espaço vectorial com produto interno, se tem \[\lVert\mathbf{x}+\mathbf{y}\rVert^2+\lVert\mathbf{x}-\mathbf{y}\rVert^2=2\lVert\mathbf{x}\rVert^2+2\lVert\mathbf{y}\rVert^2.\]

    Se \(\mathbf{x}\) e \(\mathbf{y}\) são ortogonais, i.e., \(\langle\mathbf{x},\mathbf{y}\rangle=0\), então \[\lVert\mathbf{x}+\mathbf{y}\rVert^2=\lVert\mathbf{x}\rVert^2+\lVert\mathbf{y}\rVert^2.\]

Interpretação geométrica

Modelo de regressão linear

Considere o modelo linear dado por

\[Y=\mathbf{X}\mathbf{\beta}+\mathbf{\epsilon},\] Suposições necessárias para o modelo de regressão linear:


  • A1. O modelo é linear, i.e. \(Y=\beta_0\mathbf{1}+\beta_1\mathbf{x}_1+\beta_2\mathbf{x}_2+\cdots+\beta_k\mathbf{x}_k+\mathbf{\epsilon}\);

  • A2. A matriz de regressores tem posto coluna completo;

  • A3. Exogeneidade das variáveis independentes, i.e. \(\mathbb{E}[\mathbf{\epsilon}|\mathbf{X}]=\mathbf{0}\);

  • A4. Esfericidade dos erros, i.e. \(\mathbb{E}[\mathbf{\epsilon\epsilon}'|\mathbf{X}]=\sigma^2\mathbf{I}\);

  • A5. Os erros são normalmente distribuidos, i.e.  \(\mathbf{\epsilon}|\mathbf{\mathbf{X}}\) segue uma distribuição normal multivariada com vetor de médias \(\mathbf{0}\) e matriz de covariâncias \(\sigma^2\mathbf{I}\).

Mínimos quadrados ordinários (MQO)

O método MQO tem como objetivo encontrar \(\widehat{\mathbf{\beta}}=\underset{\mathbf{\beta}\,\in\,\Theta}{\arg\min}\, S(\mathbf{\beta})\), onde \[ S(\mathbf{\beta})=\mathbf{\epsilon}'\mathbf{\epsilon}=(Y-\mathbf{X\,\beta})'(Y-\mathbf{X\,\beta}). \] Pelas Suposições A1. e A2., o estimador de MQO para \(\mathbf{\beta}\) é dado por

\[\mathbf{\widehat{\beta}}=\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'Y.\]

Pelas Suposições A1-A3, o estimador MQO é não-viesado para \(\mathbf{\beta}\), i.e., \(\mathbb{E}\left[\widehat{\mathbf{\beta}}\,\big|\,\mathbf{X}\right]=\mathbf{\beta}\). Considerando adicionalmente a Suposição A4, \(\textrm{cov}\left[\widehat{\beta}\,\big|\,\mathbf{X}\right]=\sigma^2\left(\mathbf{X}'\mathbf{X}\right)^{-1}\).

Equações normais

O sistema de equações normais é dado por \[ \mathbf{X}'\mathbf{X\widehat{\beta}}=\mathbf{X}'Y. \]

Algumas considerações

  • Seja \(\hat{Y}=\mathbf{X\widehat{\beta}}\) o vetor ajustado associado ao vetor \(Y\). Observe-se que

\[\hat{Y}=\mathbf{X\widehat{\beta}}=\mathbf{X}\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'Y=\mathbf{H}Y.\] A matriz \(\mathbf{H}=\mathbf{X}\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\) é de dimensão \(n\times n\) e será chamada matriz “hat” (matriz chapéu, na tradução livre).

A matriz “hat”, também chamada de matriz de projeção, será de grande relevância na análise de regressão.

Algumas propriedades da matriz \(\textbf{H}\)

A matriz “hat”, dada por \[\mathbf{H}=\mathbf{X}\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\] é a matriz de projeção ortogonal no espaço coluna da matriz \(\mathbf{X}\). A matriz \(\textbf{H}\) satisfaz as seguintes propriedades

  1. \(\mathbf{X}'\left(Y-\mathbf{X\widehat{\beta}}\right)=\mathbf{X}'\left(Y-\mathbf{H}Y\right)=\mathbf{0}\). Em outras palavras, \((\mathbf{I}-\mathbf{H})Y\) e \(\mathbf{X}\) são ortogonais;

  2. \(\mathbf{H}\) é simétrica (assim como \(\mathbf{I}-\mathbf{H}\));

  3. \(\mathbf{H}\) é idempotente, i.e., \(\mathbf{H}^2=\mathbf{H}\) (assim como \(\mathbf{I}-\mathbf{H}\));

  4. \(\mathbf{X}\) é invariante sob \(\mathbf{H}\), i.e., \(\mathbf{HX}=\mathbf{X}\), então \(\left(\mathbf{I}-\mathbf{H}\right)\mathbf{X}=\mathbf{0}\);

  5. \(\left(\mathbf{I}-\mathbf{H}\right)\mathbf{H}=\mathbf{H}\left(\mathbf{I}-\mathbf{H}\right)=\mathbf{0}\).

  • A diferença entre os vetores observado e ajustado é chamado de vetor residual ou vetor de resíduos, i.e., \(\mathbf{e} = Y-\hat{Y}\). Em termos da matriz “hat”, o vetor de resíduos pode ser escrito como \[\mathbf{e}=Y-\hat{Y}=Y-\mathbf{X\widehat{\beta}}=Y-\mathbf{H}Y=(\mathbf{I}-\mathbf{H})Y;\]

  • O vetor \(Y\) pode ser representado como a soma de duas componentes ortogonais, uma componente de projeção (ajustado) e uma componente residual, i.e., \[Y=\mathbf{H}Y+\left(\mathbf{I}-\mathbf{H}\right)Y.\]

    Dessa forma, usando o teorema de Pitágoras, \[Y'Y=Y'\mathbf{H}'\mathbf{H}Y+Y'\left(\mathbf{I}-\mathbf{H}\right)'\left(\mathbf{I}-\mathbf{H}\right)Y=\hat{Y}'\hat{Y}+\mathbf{e}'\mathbf{e}\] ou \(\quad\lVert Y\rVert^2=\lVert\hat{Y}\rVert^2+\lVert \mathbf{e}\rVert^2=\lVert\hat{Y}\rVert^2+\lVert Y-\hat{Y}\rVert^2\).

Exercícios

Sugestão de exercícios

  1. Mostre que \(\mathbb{E}\left[\hat{Y}\right]=\mathbf{X}\mathbf{\beta}\) e \(\mathrm{cov}[\hat{Y}]=\sigma^2\mathbf{H}\);

  2. Mostre que \(\mathbb{E}\left[\mathbf{e}\right]=0\) e \(\mathrm{cov}[\mathbf{e}]=\sigma^2(\mathbf{I-\mathbf{H}})\);

  3. Mostre que \[\hat{\sigma}^2=\frac{\mathbf{e}'\mathbf{e}}{n-k-1}=\frac{Y'(\mathbf{I}-\mathbf{H})Y}{n-k-1}\] é um estimador não-viesado de \(\sigma^2\);

  4. Mostre que os autovalores de \(\mathbf{H}\) e \(\mathbf{I}-\mathbf{H}\) são \(0\) ou \(1\).

  5. Suponha que \(\mathbf{X}\) é de dimensão \(n \times k\). Mostre que existem \(n-k\) autovalores de \(\mathbf{H}\) iguais a \(0\), e os \(k\) autovalores restantes iguais a \(1\). Similarmente, \(k\) autovalores de \(I - P\) iguais a \(0\) e \(n-k\) autovalores iguais a \(1\).

Referências

Greene, W. H. (2003), Econometric Analysis, Pearson Education.
Harville, D. A. (1997), Matrix algebra from a statistician’s perspective, New York: Springer.
Magnus, J. R., e Neudecker, H. (2019), Matrix Differential Calculus with Applications in Statistics and Econometrics, John Wiley.
Searle, S. R. (2017), Matrix Algebra Useful for Statistics, Wiley-Interscience.

Política de proteção aos direitos autorais

O conteúdo disponível consiste em material protegido pela legislação brasileira, sendo certo que, por ser o detentor dos direitos sobre o conteúdo disponível na plataforma, o LECON e o NEAEST detém direito exclusivo de usar, fruir e dispor de sua obra, conforme Artigo 5o, inciso XXVII, da Constituição Federal e os Artigos 7o e 28o, da Lei 9.610/98. A divulgação e/ou veiculação do conteúdo em sites diferentes à plataforma e sem a devida autorização do LECON e o NEAEST, pode configurar violação de direito autoral, nos termos da Lei 9.610/98, inclusive podendo caracterizar conduta criminosa, conforme Artigo 184o, §1o a 3o, do Código Penal. É considerada como contrafação a reprodução não autorizada, integral ou parcial, de todo e qualquer conteúdo disponível na plataforma.

Material elaborado pela equipe LECON/NEAEST: Alessandro J. Q. Sarnaglia, Bartolomeu Zamprogno, Fabio A. Fajardo, Luciana G. de Godoi e Nátaly A. Jiménez.