POLI SCI
PSet3.Rmd

# Sse sumi1ngdpi beta0 beta1polityi2 g now use linear

• 7

This preview shows pages 2–4. Sign up to view the full content.

SSE = $\sum_{i=1}^n(GDP_i-(\beta_0 + \beta_1Polity_i))^2$ ####(g) Now use linear regression to regress gdpenl on polity2l using the lm function in R - make sure you save the model as an object. Show the result using the summary() command. Interpret the meaning of the coefficient estimates (both the intercept and the coefficients on polity2l). Bonus: Consider the p-values reported on the table in your interpretation, if you want to read ahead and figure out what these mean. {r} model1 <- lm(gdpenl~ polity2l, data = fl2) summary(model1)  When the polity rating is 0 (the intercept), the estimated GDP is 2.46. For the polity2l coefficients, the estimated increase in GDP when there is a one-unit increase in polity is -0.011 (indicating a negative relationship/slope). P-Value: A probability value indicates how probable an outcome is under the curve. Outcomes with a P-value of 0.05 or lower are considered statistically significant and reject the null hypothesis. In this case the P-value at the intercept is 1.27e^-07, meaning that the data at the intercept is statistically significant. However, the P-value for polity2l is 0.86, meaning that it fails to reject the null hypothesis and that the overall data collected is not statistically significant . ####(h) Sometimes we need to transform a variable to make it more suitable to analysis by regression. For example, with income-related variables like gdpenl, we usually need to take their log first before using regression. Create a new variable that is equal to the log of gpdenl.

This preview has intentionally blurred sections. Sign up to view the full version.

{r} log.gdpnl <- log(fl2$gdpenl)  ####(i) Now remake a scatter plot like before but with polity2l on the horizontal access and the log of gdpenl on the vertical axis. Add the regression line. {r} plot(log.gdpnl ~ polity2l, data = fl2, xlab = "Polity Rating", ylab = "Log of GDP per Capita", main = "Relationship between Levels of Democracy and Log of GDP per Capita") abline(lm(log.gdpnl ~ polity2l, data = fl2), col = "blue")  It turns out that when you regress a logged dependent variable on an (unlogged) independent variable, we can roughly interpret the coefficient$\beta$as meaning "a one-unit shift in the independent variable corresponds to a 100$\beta$*percent* increase in the dependent variable." For example, a$\beta$of 0.01 from such a regression would imply that a one- unit change in the independent variable is associated with a$1\%\$ higher value of the dependent variable. (This is just an approximation, but for coefficient estimates near zero, it is okay.) ####(j) Using this knowledge, re-run your regression but now regress the (log of) gdpenl on polity2l. Use summary() to show the results. Interpret the new coefficient on polity2l. How has it changed compared to your earlier regression? Would you say your results are robust? Bonus: Interpret the new p- value. {r} model2 <-lm(log.gdpnl ~ polity2l, data = fl2) summary(model2)  The new coefficient of the log of GDP per Capita is 0.049, indicating a weak positive relationship between (the log of) GDP per capita and the polity rating.
This is the end of the preview. Sign up to access the rest of the document.
• Winter '16
• Lasala

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern