Calling NSDIFFS (R forecast package) Problems

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

Calling NSDIFFS (R forecast package) Problems

Postby CharlieEVIEWS » Thu Dec 18, 2014 8:47 am

Dear all,

Apologies in advance for cross-posting from stats.stack (http://stats.stackexchange.com/question ... easonality). I've been using the EViews statconn DCOM interface to loop a large number of series from FRED through the nsdiffs function in the forecast library of R to examine what percent of serues require seasonal differencing. However, after a trial run of 26,000+ series, the OCSB test returns 1,245 positive results (output=1), but the Canova Hansen test returns zero. While I appreciate that the CH test will return less positive results, this still makes me extremely suspicious of the fact that I'm doing something wrong, but can't figure out exactly what:

Code: Select all

wfopen C:\<insertpath>\test1.wf1 group groupall * groupall.drop resid !keriesnumber = (groupall.@count) vector(!seriesnumber) kpss_vector vector(!seriesnumber) ch_vector vector(!seriesnumber) ocsb_vector xopen(type=r,case=lowercase) !count=0 for !k = 1 to !seriesnumber xput(rtype=ts) sertest!k 'pass the series from EViews to R xrun library(forecast) 'call necessary forecast library xrun sertest!k <- ts(sertest!k, start=c(1990, 1), end=c(2014, 6), frequency=12) 'specify timeseries properties xrun kpss_!k<- ndiffs(sertest!k) 'kpss test xrun ch_!k<-nsdiffs(sertest!k,m=frequency(sertest!k),test=c("ch")) 'ch test xrun ocsb_!k<-nsdiffs(sertest!k,m=frequency(sertest!k),test=c("ocsb")) 'ocsb test xget kpss_!k 'return the three output integers back to eviews xget ch_!k xget ocsb_!k !count=!count+1 kpss_vector(!count)=kpss_!k 'store the results in a vector ch_vector(!count)=ch_!k ocsb_vector(!count)=ocsb_!k next xclose
Am I mis-specifying the frequency or something in the nsdiffs command? If so, why is it (I think correctly?) undertaking the OCSB without issue: ~1/26 seems a reasonable amount of times to not reject the null on a dataset of this type. I'm hoping that as a non-native R user I'm merely just forgetting to call a library or something simple and some kind soul can identify this issue:). Otherwise, it seems strange that no macroeconomic series out of the 26000 i tested would require seasonal differencing under the CH test. I also tried a similar routine with some of the data from the original CH paper (http://www.ssc.wisc.edu/~bhansen/progs/jbes_95.html) but **still** couldnt manage to find the hallowed output=1.

Any help would of course be hugely, hugely appreciated.

Best wishes, and happy holidays.

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests