Regression

BASC0005 Quantitative Methods 2: Data Science and Visualisation

Ollie Ballinger

Outline

  1. Visualization
  2. Ordinary Least Squares (OLS)
    1. Fitting a Model
    2. Estimating Coefficients
    3. Standard Errors
    4. Confidence Interval on Predicted Values
  3. Assumptions

1. Visualisation

Nighttime Lights and Literacy

Nighttime Lights and GDP Per Capita

Dark STS

  • Secondary segmentation model used to count visible ships in the satellite-based STS detections
  • ”Dark STS” defined as
    • n visible ships > n AIS pings
  • Over 500 identified in 2023 alone:

Two continuous variables

  • In the gender/race pay gap example, we had one categorical variable (gender/race) and one continuous variable (income).
  • What if we wanted to measure the relationship between two continuous variables, like income and years of schooling?

2. Ordinary Least Squares

2.1 Model Fit

1.3 Regression Coefficients

2.4 Standard Errors

Confidence intervals for the coefficients

But due to error, every time we measure the response Y for a fixed value of X we will obtain a different observation.

Confidence intervals for the coefficients

One set of observations, “one realization” we obtain one set of Ys (red crosses).

Confidence intervals for the coefficients

Another set of observations, “another realization” we obtain another set of Ys (green crosses).

Confidence intervals for the coefficients

Another set of observations, “another realization” we obtain another set of Ys (black crosses).

3. Assumptions

Linear Regression Assumptions

  1. Normality
  2. Homoscedasticity
  3. Independence

1. Normality

  • The residuals from the regression should be normally distributed
  • If they are not, our model does not perform consistently across the full range of our data
  • The relationship between the variables may not be linear

Non-Linear relationships

Linear-Linear

Log-Linear

3. Independence

  • Observations in your sample must be independent from each other
    • i.e., The measurements for each sample subject are in no way influenced by or related to the measurements of other subjects.
  • If we have repeat observations of the same individual, we have two kinds of variation:
    • Within group
    • Across group
  • We need to conduct a Panel Regression

Any Questions?

o.ballinger@ucl.ac.uk