SEM Estimation by 2SLS

Overview The goal is to: Determine the correct setup for the first stage regression, and Provide intuition for why that is the case. Microeconomic Theory Suppose the true supply function for some product is given by price, and one (or more) exogenous supply shifers \(Z_{supply}\). To make this concrete, consider...

Read more

Omitted Variable Bias by Simulation

Overview In simulation, we can show that omitting a variable \(x_2\) can cause the point estimates for a correlated variable \(x_1\) to change from (positive) \(0.999\) with a p-value of nearly zero, to (negative!) \(-0.512\), also with a p-value of nearly zero! More generally, this reinforces the mantra that unless...

Read more

Moving Average in R, tidyverse

Problem Given some dataset, you might want to find the rolling or moving average. We can visualize this in a sample dataset as follows. Note, the k-lag moving average we want, MA-k, is the mean of the last k observations in time, including the current one. # A tibble: 48...

Read more

More