Econometric Models

Univariate Characterizations

  • In a regression setting, it's important to start with a univariate characterization of the data.
  • This involves examining the statistical summaries, features, and distributions of all variables.
  • Popular univariate graphical tools include histograms, density plots, QQ plots, and boxplots.

Statistical Summary

  • Statistical summaries help identify potential issues when building a regression model, such as NAs or values outside the expected range.

  • The pastecs and psych libraries in R can be used to generate summary statistics.

  • Example using pastecs:

    library(pastecs)
    stat.desc(rnorm(100), norm=TRUE)
    
  • Example using psych:

    library(psych)
    describe(Prestige)
    
  • The norm flag includes normal distribution statistics like skewness and kurtosis.

Histograms

  • Histograms are essential for understanding each variable's properties.

  • Key aspects to look for:

    • Outliers: Can influence the regression fit.
    • Shape: Symmetric, skewed, etc.
    • Range: Very large ranges (several orders of magnitude).
    • Density/Clustering: Clustering in certain regions can lead to unstable fits in less dense ones.
  • The near-optimal number of bins kk can be calculated as: k=1+log2(n)k = 1 + log_2(n)

  • Freedman-Diaconis (FD) formula for bin width:
    2(Q3−Q1)n1/3\frac{2(Q3 - Q1)}{n^{1/3}}

  • Example in R:

    n = 1000; k = 1 + log2(n)
    hist(rnorm(n), breaks = k, col="skyblue4", main = "Normal Distr. Using k ")
    hist(rnorm(n), breaks = "FD", col="skyblue4", main = "Normal Distr. Using FD")
    hist(rexp(n,0.5), breaks = k, col="skyblue2", main ="Exp Distr. Using k")
    hist(rexp(n,0.5), breaks = "FD", col="skyblue2", main ="Exp Distr. Using FD")
    

Density Estimation

  • Visualizing the density plot along with the histogram and rug plot can be more informative.

  • A common kernel-density estimate is:
    p^(x)=1nh∑<em>i=1nK(x−x</em>ih)p̂(x) = \frac{1}{nh} \sum<em>{i=1}^{n} K(\frac{x - x</em>i}{h})

    • KK is the kernel function (e.g., Normal distribution).
    • hh is the bandwidth (smoothness).
    • nn is the number of observations.
  • Example in R:

    n=1000
    hist(rexp(n,0.5), breaks ="FD", col="skyblue2", freq = FALSE, ylab = "Density")
    lines(density(rexp(n,0.5)), lwd = 2, col ="red")
    lines(density(rexp(n,0.5), adjust =0.5), lwd = 2, col = "blue", type ='l', lty=2)
    rug(rexp(n,0.5))
    
  • Density plots can also be created with color using ggplot2.

Quantile Plots

  • Quantile plots are useful for comparing the distribution of a variable to a theoretical reference distribution (default: Normal).

  • Example in R using the car package:

    library(car)
    attach(Prestige)
    qqPlot(~ income, data=Prestige, id=list(n=3))
    qqPlot(income ~ type, data=Prestige, layout=c(1, 3))
    qqPlot(lm(prestige ~ income + education + type, data=Duncan), envelope=.99)
    
  • These plots display quantiles of the data against quantiles of the reference distribution.

Boxplots

  • Boxplots show quantitative aspects of a variable's distribution: min, max, Q1, Q3, IQR, and Median.

  • They are convenient for comparing many distributions simultaneously or conditioning on other variables.

  • Example in R:

    Boxplot(~income, data=Prestige)
    Boxplot(Ornsteininterlocks Ornsteininterlocks~Ornsteinnation)
    
  • Parallel boxplots allow comparison across groups.

  • Error bar plots can be created using plotCI from the plotrix library.

Bivariate Characterizations

  • After univariate descriptions, examine pairwise associations.

Scatterplots

  • Scatterplots are used to examine the relationship between two variables.

  • Example using the car package:

    library(car)
    attach(Prestige)
    scatterplot(prestige ~income, lwd=3, id=TRUE)
    scatterplot(prestige ~income|type, lwd=3,col=c("blue", "green", "red"),id=TRUE)
    
  • Lowess smoother provides a locally weighted smoother.

  • Conditioning on other variables allows for examining relationships within subgroups.

  • Scatterplot matrices are useful for visualizing relationships between multiple variables.

Jittering Scatterplots

  • Jittering (adding noise) helps separate over-plotted observations.

  • Example:

    plot(Vocabvocabulary Vocabvocabulary~Vocabeducation)
    plot(jitter(Vocabvocabulary) jitter(Vocabvocabulary)~jitter(Vocabeducation))
    
  • The factor argument in jitter() controls the amount of noise added.

  • abline() and lowess() can be used to add regression lines.

The Method of Least Squares for the Simple Linear Regression

  • Regression models help quantify relationships between economic variables.
  • The model is based on assumptions about the conditional PDF of yy given xx.
    • yy is a continuous random variable with a probability density function (PDF).
    • The PDF is conditional upon a specific value of xx.
  • The conditional mean of yy is E[y∣x]E[y|x] = µy∣xµ_{y|x}, and the conditional variance is Var[y∣x]Var[y|x] = σ2σ^2.
  • Building an econometric model is necessary for quantitative economic analysis.

An Econometric Model

  • The econometric model is derived from economic theory (e.g., a supply equation).
  • Parameters of the model are known as population parameters.
  • For example, a household spends $80 plus 10 cents of each dollar of income on food.
    • Algebraically, this is y=80+0.10xy = 80 + 0.10x, where yy is weekly food expenditure and xx is weekly income.
  • The error term $$"e