> gdp<-read.csv(file.choose(), sep = ",", header = TRUE) > attach(gdp) > View(gdp) > gdp$t<-seq(1:35) > gdp$lGDP<-log(GDP) > attach(gdp) # Scatter Plot > library(ggplot2) > ggplot(gdp, aes(YEAR,GDP))+geom_line(col="red")+labs(title="GDP Growth of Ethiopia") # Whole Period Growth Rate > model0<-lm(lGDP~t, data = gdp) > summary(model0) # Chow Test >library(strucchange) >sctest(lGDP~t, type = "Chow", point = 12) # II. Parallel Regression where only the intercepts in the two regressions are different but the slopes are the same # Creating time dummy > gdp$D<-ifelse(YEAR>=1992,1,0) > attach(gdp) > gdp$D<-factor(D, levels = c(0,1), labels = c("pre","post")) > attach(gdp) > model1<-lm(lGDP~t+D, data = gdp) > summary(model1) > gdp<-cbind(gdp, pred=predict(model1)) > library(ggplot2) > ggplot(data=gdp, mapping=aes(x=t, y=lGDP, color=D)) + geom_point() + geom_line(mapping=aes(y=pred)) # Concurrent Regression where the intercepts in the two regressions are the same, but the slopes are different > attach(gdp) > gdp$D1<-ifelse(YEAR>=1992,1,0) > attach(gdp) > gdp$tD<-t*D1 > attach(gdp) > model2<-lm(lGDP~t+tD,data = gdp) > summary(model2) > curve((22.404+0.054*x), xlab = "t", ylab = "", xlim = c(1,35), col="red") > curve(22.404+0.071*x, xlab = "t", ylab = "", xlim = c(1,35), col="blue", add = TRUE) > legend( "bottomright", legend = c("post", "pre"), fill = c("red", "blue") ) # Dis-similar Regression (both the intercepts and slopes are different) > model3<-lm(lGDP~t+D+t*D, data = gdp) > summary(model3) > curve(21.9+0.0732*x, xlab = "t", ylab = "", xlim = c(1,35), col="red") > curve(22.808+0.018*x, xlab = "t", ylab = "", xlim = c(1,35), col="blue", add = TRUE) > legend( "topleft", legend = c("post", "pre"), fill = c("red","blue") )