全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
3703 2
2014-10-30
需要用R来对中国宏观经济数据进行季度调整,想使用之前比较权威的x-12-arima来做,但是不知道在R里面怎么实现。。求指导
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-12-16 15:09:28
用x12包里的x12()就好
  
x12(object,x12Parameter=new("x12Parameter"),x12BaseInfo=new("x12BaseInfo"),...)

举个例子吧——
##Notrun:
x12path("../x12a.exe")
xts<-x12(AirPassengers)
summary(xts)
xs<-x12(new("x12Single",ts=AirPassengers))
summary(xs)
xb<-x12(new("x12Batch",list(AirPassengers,AirPassengers,AirPassengers)))
summary(xb)
#Createnewbatchobjectwith4timeseries
xb<-new("x12Batch",list(AirPassengers,AirPassengers,AirPassengers,AirPassengers))
#changetheautomdltoFALSEinall4elements
xb<-setP(xb,list(automdl=FALSE))
#changethearima.modelandarima.smodelsettingforthefirsttsobject
xb<-setP(xb,list(arima.model=c(1,1,0),arima.smodel=c(1,1,0)),1)
#changethearima.modelandarima.smodelsettingforthesecondtsobject

xb<-setP(xb,list(arima.model=c(0,1,1),arima.smodel=c(0,1,1)),2)
#changethearima.modelandarima.smodelsettingforthethirdtsobject
xb<-setP(xb,list(arima.model=c(0,1,1),arima.smodel=c(1,1,1)),3)
#changethearima.modelandarima.smodelsettingforthefourthtsobject
xb<-setP(xb,list(arima.model=c(1,1,1),arima.smodel=c(1,1,1)),4)
#runx12onallseries
xb<-x12(xb)
summary(xb)
#Setautomdl=TRUEforthefirstts
xb<-setP(xb,list(automdl=TRUE),1)
#rerunx12onallseries(thebinarieswillonlyrunonthefirstone)
xb<-x12(xb)
#summarywitholdOutput
summary(xb,oldOutput=10)
#Changetheparameterandoutputofthefirstseriesbacktothefirstrun
xb<-prev(xb,index=1,n=1)
#summarywitholdOutput(---Novalidpreviousruns.---)
summary(xb,oldOutput=10)
##End(Notrun)


呼......
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-2-9 17:11:19
DM小菜鸟 发表于 2014-12-16 15:09
用x12包里的x12()就好
  
x12(object,x12Parameter=new("x12Parameter"),x12BaseInfo=new("x12BaseInfo") ...
抱歉,很久没上论坛了,现在才看到,非常感谢~~~
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群