POP88162 Introduction to Quantitative Research Methods
Department of Political Science, Trinity College Dublin
Call:
lm(formula = democracy ~ log(gdp_per_capita), data = democracy_gdp_2020)
Residuals:
Min 1Q Median 3Q Max
-0.9363 -0.4372 0.1502 0.3861 0.7243
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.56415 0.21644 -2.606 0.00995 **
log(gdp_per_capita) 0.13642 0.02468 5.527 1.18e-07 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4507 on 173 degrees of freedom
(20 observations deleted due to missingness)
Multiple R-squared: 0.1501, Adjusted R-squared: 0.1452
F-statistic: 30.54 on 1 and 173 DF, p-value: 1.183e-07
glm_fit <- glm(democracy ~ log(gdp_per_capita), family = binomial, data = democracy_gdp_2020)
y_hat <- predict(
glm_fit,
newdata = data.frame(gdp_per_capita = seq(50, 1000000, 50)),
type = "response"
)
plot(log(democracy_gdp_2020$gdp_per_capita), democracy_gdp_2020$democracy,
xlim = c(log(50), log(1000000)),
pch = 19, col = democracy_gdp_2020$democracy + 1)
abline(lpm_fit, col = "grey", lwd = 2)
lines(
x = log(seq(50, 1000000, 50)),
y = y_hat,
col = "red"
)
autocracy democracy
colony 66 90
non-colony 6 19
autocracy democracy
colony 0.4230769 0.5769231
non-colony 0.2400000 0.7600000
\[\widehat{OR}_{NC/C} = \frac{\widehat{Odds}_{NC}}{\widehat{Odds}_{C}} = \frac{3.17}{1.38} = 2.3\]
where:
\[\pi_i = \frac{exp(\alpha + \beta_1 X_{1i} + \beta_2 X_{2i} + \ldots + \beta_k X_{ki})}{1 + exp(\alpha + \beta_1 X_{1i} + \beta_2 X_{2i} + \ldots + \beta_k X_{ki})}\]
\[\pi_i = \frac{exp(\alpha + \beta X_{i})}{1 + exp(\alpha + \beta X_{i})}\]
for a simple logistic model with one continuous \(X\)
Call:
glm(formula = democracy ~ log(gdp_per_capita) + noncol, family = binomial(link = "logit"),
data = democracy_gdp_2020)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -5.08270 1.21876 -4.170 3.04e-05 ***
log(gdp_per_capita) 0.65378 0.14540 4.497 6.91e-06 ***
noncolnon-colony -0.08905 0.56937 -0.156 0.876
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 226.17 on 169 degrees of freedom
Residual deviance: 200.15 on 167 degrees of freedom
(25 observations deleted due to missingness)
AIC: 206.15
Number of Fisher Scoring iterations: 3
\[\widehat{log\left(\frac{\pi_i}{1 - \pi_i}\right)} = -5.08 + 0.65 \times \text{log(GDP)}_i -0.08 \times \text{Non-colony}_i\]