rm(list=ls())
ls()
library(plm)
data=read.csv("C:\\Users\\acer\\Desktop\\stata.csv", header = TRUE);data#读入数据
levels(data$y1)#y1是因子
data$y1[1]/10#不能运算
xiancheng=data[1:204,]#去掉缺省值
attach(xiancheng)#数据绑定
y=as.vector(y1)
y=as.numeric(y)#把数据转化为可运算的数值型,不能一步到位,否则数据将被更改
y <- data.frame(split(y, xian))#把y按xian分组
purtest(y ,pmax =0, exo = "none", test = "madwu")#单位根检验
Johasen 检验
require("urca")
sink("citest.txt")
ci_real_max<- ca.jo(data_ts[,c(2,1,8,5,4)],type="eigen",ecdet="trend",spec="transitory",
season=4);summary(ci_real_max)
ci_real_max<- ca.jo(data_ts[,c(2,1,8,5,4)],type="eigen",ecdet="const",spec="transitory",
season=4);summary(ci_real_max)
ci_real_max<- ca.jo(data_ts[,c(2,1,8,5,4)],type="eigen",ecdet="none",spec="transitory",
season=4);summary(ci_real_max)
ci_real_trace<- ca.jo(data_ts[,c(2,1,8,5,4)],type="trace",ecdet="trend",spec="transitory",
season=4);summary(ci_real_trace)
ci_real_trace<- ca.jo(data_ts[,c(2,1,8,5,4)],type="trace",ecdet="const",spec="transitory",
season=4);summary(ci_real_trace)
ci_real_trace<- ca.jo(data_ts[,c(2,1,8,5,4)],type="trace",ecdet="none",spec="transitory",
season=4);summary(ci_real_trace)
sink();shell.exec("citest.txt")
|