面板数据回归:R语言code
library(plm) library(psych) library(xts) library(tseries) library(lmtest) ## import dataset datas<-read.table("data.txt",header =TRUE) ## adf test pcgdp<-xts(datas$PCGDP,as.Date(datas$year)) adf.test(pcgdp) # result: stationary ltax<-xts(datas$Ltax,as.Date(datas$year)) adf.test(ltax) # result: stationary hp<-xts(datas$hp,as.Date(datas$year)) adf.test(hp) # result: stationary lp<-xts(datas$lp,as.Date(datas$year)) adf.test(lp) # result: stationary ## 协整检验 # Engle-Granger reg<-lm(datas$hp~datas$lp+datas$Ltax+datas$PCGDP) summary(reg) error<-residuals(reg) adf.test(error) # result: residuals