STA13824 - Análise de regressão


Estimação dos parâmetros



LECON/DEST - UFES

Última atualização: 04 maio, 2025

Alguns resultados da álgebra matricial

Os seguintes resultados são facilmente encontrados em qualquer livro de álgebra matricial. Para detalhes sugere-se a consulta das seguintes referências Magnus e Neudecker (2019), Harville (1997) ou Searle (2017).

  • Matriz trasposta: A trasposta de uma matriz \(\mathbf{A}\) é a matriz que se obtém da troca das linhas pelas colunas da matriz, ou seja, se \(\mathbf{A}=(a_{ij})_{i,j=1}^{m,n}\), então \(\mathbf{A}'=(a_{ij})_{i,j=1}^{n,m}\). Em outras palavras,

\[\mathbf{A}=\left[ \begin{array}{ccccc} a_{11}&a_{12}&a_{13}&\cdots&a_{1n} \\ a_{21}&a_{22}&a_{23}&\cdots&a_{2n} \\ \vdots&\vdots&\vdots&\ddots&\vdots\\ a_{m1}&a_{m2}&a_{m3}&\cdots&a_{mn} \\ \end{array} \right] \qquad \mathbf{A}'=\left[ \begin{array}{ccccc} a_{11}&a_{21}&a_{31}&\cdots&a_{m1} \\ a_{12}&a_{22}&a_{32}&\cdots&a_{m2} \\ \vdots&\vdots&\vdots&\ddots&\vdots\\ a_{1n}&a_{2n}&a_{3n}&\cdots&a_{mn} \\ \end{array} \right] \]

Propriedades: Sejam \(\mathbf{A}\) e \(\mathbf{B}\) matrizes com dimensões adequadas.

  1. \(\left(\mathbf{A}'\right)'=\mathbf{A}\);

  2. \((\mathbf{A}+\mathbf{B})'=\mathbf{A}'+\mathbf{B}'\);

  3. \(\left(c\mathbf{A}\right)'=c\mathbf{A}'\);

  4. \(\left(\mathbf{AB}\right)'=\mathbf{B}'\mathbf{A}'\);

  5. \(\left(\mathbf{A}'\right)^{-1}=\left(\mathbf{A}^{-1}\right)'\), \(\, \mathbf{A}\) não-singular;

  6. \(\det\left(\mathbf{A}'\right)=\det\left(\mathbf{A}\right)\);

  • Matriz Simétrica: Uma matriz quadrada \(\mathbf{A}\) é simétrica se \(\mathbf{A}=\mathbf{A}'\).

  • Matriz Idempotente: Uma matriz quadrada \(\mathbf{A}\) é idempotente se \(\mathbf{A}\mathbf{A}=\mathbf{A}\).

  • Matriz Ortogonal: Uma matriz quadrada \(\mathbf{A}\) se diz ortogonal se \(\mathbf{A}'\mathbf{A}=\mathbf{A}\mathbf{A}'=\mathbf{I}\).

  • Autovalores: Seja \(\lambda\) um escalar. Dizemos que \(\lambda\) é autovalor de uma matriz quadrada \(\mathbf{A}\), se existe um vetor não-nulo \(\mathbf{x}\), tal que \[\mathbf{Ax}=\lambda\mathbf{x}\] ou equivalentemente \[\left(\mathbf{A}-\lambda\mathbf{I}\right)\mathbf{x}=\mathbf{0}.\] Fica evidente que \(\lambda\) é autovalor de \(\mathbf{A}\) see a matriz \(\mathbf{A}-\lambda\mathbf{I}\) é singular, i.e., \(\lambda\) é autovalor da \(\mathbf{A}\) see \[\det\left(\mathbf{A}-\lambda\mathbf{I}\right)=\left|\mathbf{A}-\lambda\mathbf{I}\right|=0.\]
  • Formas quadráticas: Uma forma quadrática em \(\mathbb{R}^n\) é uma função polinomial cujos termos são de segundo grau, i.e., seja \(\mathbf{A}\) uma matriz simétrica e considere um vetor \(\mathbf{x}=\left(x_1,x_2,\ldots,x_n\right)'\), então

\[\mathbf{x}'\mathbf{Ax}=\sum_{i,j}a_{ij}x_ix_j=\sum_{i=1}^na_{ii}x_i^2+2\sum_{i<j}a_{ij}x_ix_j.\]

  • Derivada de formas quadráticas: Seja \(\mathbf{A}\) uma matriz simétrica e \(\mathbf{x}'\mathbf{Ax}\) a forma quadrática associada à matriz. Então:
    • \(\frac{\partial\mathbf{x}'\mathbf{Ax}}{\partial\mathbf{x}}=2\mathbf{Ax}\);
    • \(\frac{\partial^2\mathbf{x}'\mathbf{Ax}}{\partial\mathbf{x}\partial\mathbf{x}'}=2\mathbf{A}\);
    • \(\frac{\partial\mathbf{x}'\mathbf{Ax}}{\partial\mathbf{A}}=\mathbf{x}\mathbf{x}'\).
    Para formas lineares, considere \(\mathbf{Ax}\), então \(\frac{\partial\mathbf{Ax}}{\partial\mathbf{x}'}=\mathbf{A}\) e \(\frac{\partial\left(\mathbf{Ax}\right)'}{\partial\mathbf{x}}=\mathbf{A}'\).
  • Matriz definida positiva: Uma matriz quadrada \(\mathbf{A}\) se diz definida positiva se a forma quadrática associada à matriz é positiva, isto é, \(\mathbf{x}'\mathbf{Ax}>0\), para todo \(\mathbf{x}\ne\mathbf{0}\).

    • Uma matriz simétrica \(\mathbf{A}\) se diz definida negativa se \(-\mathbf{A}\) é definida positiva;
    • Uma matriz simétrica \(\mathbf{A}\) se diz semidefinida positiva se \(\mathbf{x}'\mathbf{Ax}\ge0\), para todo \(\mathbf{x}\ne\mathbf{0}\);
    • Uma matriz simétrica \(\mathbf{A}\) se diz semidefinida negativa se \(-\mathbf{A}\) é semidefinida positiva.


  • Propriedades: Seja \(\mathbf{A}\) uma matriz simétrica definida positiva, então
    • \(\mathbf{A}\) é não-singular;
    • Os autovalores de \(\mathbf{A}\) são todos positivos;
    • \(\mathbf{A}^{-1}\) é positiva definida.

Suposições do modelo de regressão linear

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}\).

A2. A matriz \(\mathbf{X}\) tem posto coluna completo

Mínimos quadrados ordinários (MQO)

Considere o modelo é linear, dado por

\[Y=\mathbf{X\,\beta}+\mathbf{\epsilon}.\] ou \[Y=\beta_0\mathbf{1}+\beta_1\mathbf{x}_1+\beta_2\mathbf{x}_2+\cdots+\beta_k\mathbf{x}_k+\mathbf{\epsilon}.\] Nosso objetivo é estimar o vetor de parâmetros \[\mathbf{\beta}=[\beta_1,\beta_2,\ldots,\beta_k]'.\]

O método de mínimos quadrados é um dos tantos métodos existentes na literatura, que permitirá atingir nosso objetivo.

O método MQO tem como meta minimizar a seguinte função objetivo

\[ \begin{aligned} S(\mathbf{\beta})=\mathbf{\epsilon}'\mathbf{\epsilon}&=(Y-\mathbf{X\,\beta})'(Y-\mathbf{X\,\beta}) \\ &=Y'Y-Y'\mathbf{X\beta}-\mathbf{\beta}'\mathbf{X}'Y+\mathbf{\beta}'\mathbf{X}'\mathbf{X\beta}\\ &=Y'Y-2Y'\mathbf{X\beta}+\mathbf{\beta}'\mathbf{X}'\mathbf{X\beta}. \end{aligned} \]

Dessa forma, \[ \widehat{\mathbf{\beta}}=\underset{\mathbf{\beta}\,\in\,\Theta}{\arg\min}\, S(\mathbf{\beta}). \] A minimização se dá ao derivar \(S(\mathbf{\beta})\) em relação ao \(\mathbf{\beta}\) e igualar a vetor \(\mathbf{0}\), daí

\[ \frac{\partial S(\mathbf{\beta})}{\partial\beta}=-2\mathbf{X}'Y+2\mathbf{X}'\mathbf{X\beta}. \]

Igualando a \(\mathbf{0}\), temos que \(-2\mathbf{X}'Y+2\mathbf{X}'\mathbf{X\widehat{\beta}}=0\). Daí que,

\[ \mathbf{X}'\mathbf{X\widehat{\beta}}=\mathbf{X}'Y. \] O sistema de equações acima é denominado equações normais. O nome deve-se a que podemos reescrever o sistema de equações como

\[ \mathbf{X}'\left(\mathbf{X\widehat{\beta}}-Y\right)=\mathbf{0}. \] O vetor \(\mathbf{X\widehat{\beta}}-Y\) é chamado de vetor de resíduos e, segundo a equação acima, esse vetor é normal (ortogonal) aos vetores linha de \(\mathbf{X}\).


De acordo com A2., a matriz \(\mathbf{X}\) tem posto coluna completo, então \(\mathbf{X}'\mathbf{X}\) é uma matrix simétrica e não-singular, ou seja, \(\mathbf{X}'\mathbf{X}\) tem inversa. Dessa forma,

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

Para o ponto crítico ser ponto de mínimo, calcula-se a segunda derivada da função objetivo \(S(\mathbf{\beta})\) e verifica-se se a matriz resultante é definida positiva. Dessa forma,

\[\frac{\partial^2 S(\mathbf{\beta})}{\partial\beta\partial\beta'}=2\mathbf{X}'\mathbf{X}.\] Seja \(\mathbf{v}=\mathbf{Xc}\), para algum vetor não-nulo \(\mathbf{c}\). Seja \(q=\mathbf{v}'\mathbf{v}\). Observe que, a menos que cada elemento de \(\mathbf{v}\) seja zero, \(q\) é positivo. Por outra parte, se \(\mathbf{v}\) pudesse ser zero, então \(\mathbf{v}\) seria uma combinação linear das colunas de \(\mathbf{X}\) iguais a zero, o que contradiz a suposição A2. Dessa forma \(q>0\), i.e., \(\mathbf{X}'\mathbf{X}\) é definida positiva.


Se \(\mathbf{X}\) tem posto coluna completo, então a solução das equações normais é única e minimiza \(S(\mathbf{\beta})\).

A3. Exogeneidade das variáveis independentes

Propriedades do estimador de MQO

Sabemos que o estimador MQO é dado por

\[ \begin{aligned} \mathbf{\widehat{\beta}}&=\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'Y =\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\left(\mathbf{X\beta}+\mathbf{\epsilon}\right)\\ &=\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\mathbf{X\beta}+\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\mathbf{\epsilon}=\mathbf{\beta}+\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\mathbf{\epsilon}. \end{aligned} \]

Daí, pela Suposição A3., i.e., \(\mathbb{E}[\mathbf{\epsilon}|\mathbf{X}]=\mathbf{0}\), temos que:

\[\mathbb{E}\left[\widehat{\mathbf{\beta}}\,\big|\,\mathbf{X}\right]=\mathbf{\beta}+\mathbb{E}\left[\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\mathbf{\epsilon}\,\big|\,\mathbf{X}\right]=\mathbf{\beta}+\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\mathbb{E}\left[\mathbf{\epsilon}\,\big|\,\mathbf{X}\right]=\mathbf{\beta}.\]

Pelas Suposições A1-A3, o estimador MQO é não-viesado para \(\mathbf{\beta}\).

A4. Esfericidade dos erros

Propriedades do estimador de MQO

Sabemos que,

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

Dessa forma,

\[ \begin{aligned} \textrm{cov}\left[\widehat{\beta}\,\big|\,\mathbf{X}\right]&=\mathbb{E}\left[\left(\mathbf{\widehat{\beta}}-\mathbf{\beta}\right)\left(\mathbf{\widehat{\beta}}-\mathbf{\beta}\right)'\,\Big|\,\mathbf{X}\right]\\ &=\mathbb{E}\left[\left(\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\mathbf{\epsilon}\right)\left(\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\mathbf{\epsilon}\right)'\,\Big|\,\mathbf{X}\right]\\ &=\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\,\mathbb{E}\left[\mathbf{\epsilon}\mathbf{\epsilon}'\,\big|\,\mathbf{X}\right]\mathbf{X}\left(\mathbf{X}'\mathbf{X}\right)^{-1}. \end{aligned} \]

Pela Suposição A4., i.e., \(\mathbb{E}[\mathbf{\epsilon\epsilon}'|\mathbf{X}]=\sigma^2\mathbf{I}\), temos que

\[ \begin{aligned} \textrm{cov}\left[\widehat{\beta}\,\big|\,\mathbf{X}\right]&=\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\mathbb{E}\left[\mathbf{\epsilon}\mathbf{\epsilon}'\,\big|\,\mathbf{X}\right]\mathbf{X}\left(\mathbf{X}'\mathbf{X}\right)^{-1}\\ &=\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'\sigma^2\mathbf{I}\mathbf{X}\left(\mathbf{X}'\mathbf{X}\right)^{-1}\\ &=\sigma^2\left(\mathbf{X}'\mathbf{X}\right)^{-1}. \end{aligned} \]


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

Exercícios

Sugestão de exercícios

  1. Seja \(\mathbf{A}\) uma matriz quadrada. Mostre que as matrizes \(\mathbf{A}'+\mathbf{A}\) e \(\mathbf{A}\mathbf{A}'=\mathbf{A}'\mathbf{A}\) são simétricas;

  2. O traço de uma matriz quadrada \(\mathbf{A}=(a_{ij})_{i,j=1}^n\) define-se como \(\mathrm{tr}(\mathbf{A})=a_{11}+a_{22}+\cdots+a_{nn}\). Sejam \(\mathbf{A}\) e \(\mathbf{B}\) matrizes quadradas e \(k\) um escalar. Mostre que:

  1. \(\mathrm{tr}(k\mathbf{A})=k\mathrm{tr}(\mathbf{A})\);
  2. \(\mathrm{tr}(\mathbf{A}+\mathbf{B})=\mathrm{tr}(\mathbf{A})+\mathrm{tr}(\mathbf{B})\);
  3. \(\mathrm{tr}(\mathbf{A})=\mathrm{tr}(\mathbf{A}')\);
  1. Sejam \(\mathbf{A}\), \(\mathbf{B}\) e \(\mathbf{C}\) matrizes com dimensões adequadas para o produto. Mostre que:
  1. \(\mathrm{tr}(\mathbf{A}\mathbf{B})=\mathrm{tr}(\mathbf{B}'\mathbf{A}')=\mathrm{tr}(\mathbf{B}\mathbf{A})=\mathrm{tr}(\mathbf{A}'\mathbf{B}')\);
  2. \(\mathrm{tr}(\mathbf{A}\mathbf{B}\mathbf{C})=\mathrm{tr}(\mathbf{C}\mathbf{A}\mathbf{B})=\mathrm{tr}(\mathbf{B}\mathbf{C}\mathbf{A})\).
  1. Seja \(\mathbf{A}\) uma matriz quadrada tal que \(\mathbf{A}'\mathbf{A}=\mathbf{A}^2\).
  1. Mostre que \(\mathrm{tr}\left[(\mathbf{A}-\mathbf{A}')'(\mathbf{A}-\mathbf{A}')\right]=0\);
  2. Mostre que \(\mathbf{A}\) é simétrica.
  1. Mostre que o determinante de uma matriz simétrica \(\mathbf{A}\) pode ser calculado como o produto dos seus autovalores;

  2. Considere o modelo linear dado por \(Y=\mathbf{X}\mathbf{\beta}+\mathbf{\epsilon}\) e \(\mathbf{\widehat{\beta}}=\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'Y\) o estimador de MQO do vetor \(\mathbf{\beta}\). Os valores ajustados de \(Y\) são calculados como \[\hat{Y}=\mathbf{X}\mathbf{\widehat{\beta}}=\mathbf{X}\left(\mathbf{X}'\mathbf{X}\right)^{-1}\mathbf{X}'Y=\mathbf{H}Y.\] Mostre que as matrizes \(\mathbf{H}\) e \(\mathbf{I}-\mathbf{H}\) são simétricas e idempotentes.

Referências

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.