Applied Econometrics

profileEg0istka
HW4.docx

Bogdan Salacki

ECON - 420

R-Script for HW 4

library(readxl)

Growth_1_ <- read_excel("~/Downloads/Growth (1).xlsx")

View(Growth_1_)

#a. In preparation a scatter plot, the columns growth and trade share have to be secluded

growth<-Growth_1_$growth

tradeshare<-Growth_1_$tradeshare

# When you see the values, the plot function can be put into effect

plot(growth,tradeshare)

#Based on the scatter plot, the data looks like to have a positive correaltion/relationship.

#b. Yes, Malta looks like detached because it is the only plot with the largest tradeshare compared with the rest of the data.

#c. To find regression of the data use code below:

reg1<-lm(growth~tradeshare)

#Then, summarize the data using: summary(reg1)

#slope for tradeshare= 2.3064

#estimated intercept for growth= 0.6403

#When tradeshare = 0.5 the regression equation is: 0.6403 + 2.3064 (0.5)= 1.7935

#When tradeshare = 1, the regression equation is: 0.6403 +2.3064 (1)= 2.9467

#e. To plot the regression line on the scatter plot, use the code abline(Reg1), and it will reveal a line for the data.

#f. Malta is shown in the scatter plot to the right, farthest away from the remaining data. A reason for Malta having such a large tradeshare could be that it's imports/exports are very different from the other countries in the data thus, affecting the size or amount of it. Malta's import/exports could be of the goods that are transported a lot faster or a lot slower than the rest of the countries being analyzed. Because of that, and also because Malta was determined to be differing from all other members, it cannot be included in the analysis.