Note that throughout section we will be using the data from problem set 6.
# Libraries
library(tidyverse)
library(knitr)
library(stargazer)
library(sandwich)
library(foreign)
library(plotly)
library(reshape2)
library(glmnet)
library(caTools)
# Import data
ps6 = read.dta('/Users/trevorincerti/Box Sync/Graduate/Teaching/500/section_notes/data/qog_std_cs_15may13.dta')
# Drop all observations such that wdi_gnipc has missing values.
ps6_clean = ps6 %>%
filter(!is.na(wdi_gnipc))
# Create logged wdi_gnipc variable
ps6_clean$ln_wdi_gnipc = log(ps6_clean$wdi_gnipc)
# Keep variables needed for analysis only
ps6_clean = ps6_clean %>%
select(ccode, cname, fh_ipolity2, ln_wdi_gnipc, ciri_empinx_new)
Interpreting a coefficient in a bivariate linear regression (e.g. \(\beta_1\) in \(Y = \alpha + \beta_1 x_1\)).
\(\beta_1\) is the slope of of the BLP with respect to \(x\).
So, for our problem set, this is the slope of the BLP with respect to logged GNI. In other words, it tells us E[Y], or E[Polity], associated with a 1 unit change in logged GNI.
Shown numerically:
ps6_lm = lm(fh_ipolity2 ~ ln_wdi_gnipc, data = ps6_clean)
| Dependent variable: | |
| Polity score | |
| Logged GNI per capita | 0.846*** |
| (0.129) | |
| Constant | -0.390 |
| (1.101) | |
| Observations | 187 |
| Adjusted R2 | 0.185 |
| Note: | p<0.1; p<0.05; p<0.01 |
## `geom_smooth()` using formula 'y ~ x'
Interpreting a coefficient in a multivariate linear regression (\(Y = \alpha + \beta_1x_1 + \beta_2x_2\)).
The coefficient now represents a conditional slope.
Generally, we now interpret interpret \(\beta_1\) as the average effect on \(Y\) of a one unit increase in \(x_1\), holding all other predictors fixed.
In this case, \(\beta_1\) now represents the change in E[Polity] associated with a 1 unit change in logged GNI, holding the Empowerment Rights Index constant.
Expressed as a partial derivative:
\[\beta_1 = \frac{\partial Y}{\partial x_1} \]
ps6_lm2 = lm(fh_ipolity2 ~ ln_wdi_gnipc + ciri_empinx_new, data = ps6_clean)
| Dependent variable: | |
| Polity score | |
| Logged GNI per capita | 0.142* |
| (0.072) | |
| CIRI Empowerment score | 0.631*** |
| (0.027) | |
| Constant | 0.475 |
| (0.558) | |
| Observations | 187 |
| Adjusted R2 | 0.792 |
| Note: | p<0.1; p<0.05; p<0.01 |