Applied Econometrics
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.