Matrix Notation in Statistical Models: OLS Estimator, Variance-Covariance, R-square, Lecture notes of Statistics

An introduction to matrix notation in statistical models, focusing on the Ordinary Least Squares (OLS) estimator, variance-covariance matrix, R-square, F test, and bootstrapping. It covers the intuition behind these concepts, the variance-covariance matrix of a vector, the matrix version of homoskedasticity, the sampling variance for OLS estimates, and the estimation of error variance.

Typology: Lecture notes

2021/2022

Uploaded on 09/27/2022

little_rachel
little_rachel 🇬🇧

4.7

(6)

217 documents

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Matrix Notation OLS Estimator Variance-Covariance R-square F Test Bootstrapping
Precept 5: Simple OLS
Soc 500: Applied Social Statistics
Simone Zhang1
Princeton University
October 2016
1This draws material from Matt Blackwell.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Matrix Notation in Statistical Models: OLS Estimator, Variance-Covariance, R-square and more Lecture notes Statistics in PDF only on Docsity!

Precept 5: Simple OLS

Soc 500: Applied Social Statistics

Simone Zhang

1

Princeton University

October 2016

1 This draws material from Matt Blackwell.

Today’s Agenda

Basic matrix operations

Review matrix notation for linear regression

Notation

OLS estimation

Variance-covariance matrix

R-square

F-test

Bootstrap

OLS Estimator

β = (X

′ X)

− 1 X

′ y

What’s the intuition here?

“Numerator” X

′ y: is roughly composed of the covariances

between the columns of X and y

“Denominator” X

′ X is roughly composed of the sample

variances and covariances of variables within X

Thus, we have something like:

β ≈ (variance of X)

− 1 (covariance of X & y)

This is a rough sketch and isn’t strictly true, but it can provide

intuition.

Variance-Covariance Matrix

The homoskedasticity assumption is different: var(u|X) = σ

2

u

I

n

In order to investigate this, we need to know what the variance

of a vector is.

The variance of a vector is actually a matrix:

var[u] = ÎŁ u

var(u 1 ) cov(u 1 , u 2 )... cov(u 1 , u n

cov(u 2 , u 1 ) var(u 2 )... cov(u 2 , u n

cov(u n , u 1 ) cov(u n , u 2 )... var(u n

This matrix is symmetric since cov(ui , uj ) = cov(uj , ui )

Sampling Variance for OLS Estimates

Under assumptions 1-5, the sampling variance of the OLS

estimator can be written in matrix form as the following:

var[

β] = σ

2

u

(X

′ X)

− 1

This matrix looks like this:

β 0

β 1

β 2

β K

β 0 var[

β 0 ] cov[

β 0

β 1 ] cov[

β 0

β 2 ] ¡ ¡ ¡ cov[

β 0

β K

]

β 1 cov[

β 0

β 1 ] var[

β 1 ] cov[

β 1

β 2 ] ¡ ¡ ¡ cov[

β 1

β K

]

β 2 cov[

β 0 ,

β 2 ] cov[

β 1 ,

β 2 ] var[

β 2 ] ¡ ¡ ¡ cov[

β 2 ,

β K

]

βK cov[

β 0 ,

βK ] cov[

βK ,

β 1 ] cov[

βK ,

β 2 ] ¡ ¡ ¡ var[

βK ]

Estimating Error Variance

Note that we never observe the true error variance, σ

2

u

. We can

estimate it with the following:

̂ σ

2

u

ˆu

′ ˆu

n − (k + 1 )

where n-(K+1) = residual degrees of freedom and

̂ u

′ ̂ u = (y − X

β)

′ (y − X

β)

Sum of Squares

1 2 3 4 5 6 7 8

6

7

8

9

10

11

12

Total Prediction Errors

Log Settler Mortality

Log GDP per capita growth

Sum of Squares

1 2 3 4 5 6 7 8

6

7

8

9

10

11

12

Residuals

Log Settler Mortality

Log GDP per capita growth

F Test Procedure

The F statistic can be calculated by the following procedure:

(^1) Fit the Unrestricted Model (UR) which does not impose H 0

(^2) Fit the Restricted Model (R) which does impose H 0

(^3) From the two results, compute the F Statistic:

F 0 =

(SSRr − SSRur )/q

SSRur /(n − k − 1 )

where SSR=sum of squared residuals, q=number of restrictions,

k=number of predictors in the unrestricted model, and n= # of

observations.

Intuition:

increase in prediction error

original prediction error

The Bootstrap

We see a single sample that is a draw from a population:

There’s a true mean loan amount; we only observe one sample

Since we cannot resample from the population, we resample from the

sample!

Idea: Within a loop, generate a bootstrapped sample:

(^1) Sample from { 1 , 2 ,... , N} with replacement

2 Re-calculate the quantity of interest on each bootstrapped sample

(^3) Resampling from the sample approximates sampling again from the

full population (giving us a sense of the sampling distribution)

(Thanks to Ted Enamorado for sharing slides on bootstrapping)

Simple Example with Sample Means

Let X i

Bootstrapped Samples:

X

boot

X

boot, 1

X

boot, 1

X

boot, 1

Bootstrapped Standard Error

Bootstrapped Standard Error

sd(

X

boot

Bootstrapped Confidence Interval:

Take the 2.5% and 97.5% quantiles of

Xboot