A blog by Rob J Hyndman 

Twitter Gplus RSS

Posts Tagged ‘R’:

Coherent population forecasting using R

Published on 24 July 2014

This is an exam­ple of how to use the demog­ra­phy pack­age in R for sto­chas­tic pop­u­la­tion fore­cast­ing with coher­ent com­po­nents. It is based on the papers by Hyn­d­man and Booth (IJF 2008) and Hyn­d­man, Booth and Yas­meen (Demog­ra­phy 2013). I will use Aus­tralian data from 1950 to 2009 and fore­cast the next 50 years. In demog­ra­phy, “coher­ent” fore­casts are where male and females (or other sub-​​​​groups) do not diverge over time. (Essen­tially, we require the dif­fer­ence between the groups to be sta­tion­ary.) When we wrote the 2008 paper, we did not know how to con­strain the fore­casts to be coher­ent in a func­tional data con­text and so this was not dis­cussed. My later 2013 paper pro­vided a way of impos­ing coher­ence. This blog post shows how to imple­ment both ideas using R.

No Comments  comments 

Plotting the characteristic roots for ARIMA models

Published on 23 July 2014

When mod­el­ling data with ARIMA mod­els, it is some­times use­ful to plot the inverse char­ac­ter­is­tic roots. The fol­low­ing func­tions will com­pute and plot the inverse roots for any fit­ted ARIMA model (includ­ing sea­sonal models).

No Comments  comments 

Variations on rolling forecasts

Published on 16 July 2014

Rolling fore­casts are com­monly used to com­pare time series mod­els. Here are a few of the ways they can be com­puted using R. I will use ARIMA mod­els as a vehi­cle of illus­tra­tion, but the code can eas­ily be adapted to other uni­vari­ate time series models.

No Comments  comments 

Varian on big data

Published on 16 June 2014

Last week my research group dis­cussed Hal Varian’s inter­est­ing new paper on “Big data: new tricks for econo­met­rics”, Jour­nal of Eco­nomic Per­spec­tives, 28(2): 3–28. It’s a nice intro­duc­tion to trees, bag­ging and forests, plus a very brief entrée to the LASSO and the elas­tic net, and to slab and spike regres­sion. Not enough to be able to use them, but ok if you’ve no idea what they are.

No Comments  comments 

Specifying complicated groups of time series in hts

Published on 15 June 2014

With the lat­est ver­sion of the hts pack­age for R, it is now pos­si­ble to spec­ify rather com­pli­cated group­ing struc­tures rel­a­tively eas­ily. All aggre­ga­tion struc­tures can be rep­re­sented as hier­ar­chies or as cross-​​​​products of hier­ar­chies. For exam­ple, a hier­ar­chi­cal time series may be based on geog­ra­phy: coun­try, state, region, store. Often there is also a sep­a­rate prod­uct hier­ar­chy: prod­uct groups, prod­uct types, packet size. Fore­casts of all the dif­fer­ent types of aggre­ga­tion are required; e.g., prod­uct type A within region X. The aggre­ga­tion struc­ture is a cross-​​​​product of the two hier­ar­chies. This frame­work includes even appar­ently non-​​​​hierarchical data: con­sider the sim­ple case of a time series of deaths split by sex and state. We can con­sider sex and state as two very sim­ple hier­ar­chies with only one level each. Then we wish to fore­cast the aggre­gates of all com­bi­na­tions of the two hier­ar­chies. Any num­ber of sep­a­rate hier­ar­chies can be com­bined in this way. Non-​​​​hierarchical fac­tors such as sex can be treated as single-​​​​level hierarchies.

No Comments  comments 

European talks. June-​​July 2014

Published on 14 June 2014

For the next month I am trav­el­ling in Europe and will be giv­ing the fol­low­ing talks. 17 June. Chal­lenges in fore­cast­ing peak elec­tric­ity demand. Energy Forum, Sierre, Valais/​​Wallis, Switzer­land. 20 June. Com­mon func­tional prin­ci­pal com­po­nent mod­els for mor­tal­ity fore­cast­ing. Inter­na­tional Work­shop on Func­tional and Oper­a­to­r­ial Sta­tis­tics. Stresa, Italy. 24–25 June. Func­tional time series with appli­ca­tions in demog­ra­phy. Hum­boldt Uni­ver­sity, Berlin. 1 July. Fast com­pu­ta­tion of rec­on­ciled fore­casts in hier­ar­chi­cal and grouped time series. Inter­na­tional Sym­po­sium on Fore­cast­ing, Rot­ter­dam, Netherlands.

No Comments  comments 

ARIMA models with long lags

Published on 8 May 2014

Today’s email ques­tion: I work within a gov­ern­ment bud­get office and some­times have to fore­cast fairly sim­ple time series sev­eral quar­ters into the future. Auto.arima() works great and I often get some­thing along the lines of: ARIMA(0,0,1)(1,1,0)[12] with drift as the low­est AICc. How­ever, my boss (who does not use R) takes issue with low-​​​​order AR and MA because “you’re essen­tially using fore­casted data to make your fore­cast.” His mod­els include AR(10) MA(12)s etc. rather fre­quently. I argue that’s over­fit­ting. I don’t see a great deal of dis­cus­sion in text­books about this, and I’ve never seen such higher-​​​​order mod­els in a text­book set­ting. But are they fairly com­mon in prac­tice? What con­cerns could I raise with him about higher-​​​​order mod­els? Any advice you could give would be appreciated.

3 Comments  comments 

New jobs in business analytics at Monash

Published on 4 May 2014

We have an excit­ing new ini­tia­tive at Monash Uni­ver­sity with some new posi­tions in busi­ness ana­lyt­ics. This is part of a plan to strengthen our research and teach­ing in the data science/​​computational sta­tis­tics area. We are hop­ing to make mul­ti­ple appoint­ments, at junior and senior lev­els. These are five-​​​​year appoint­ments, but we hope that the posi­tions will con­tinue after that if we can secure suit­able funding.

2 Comments  comments 

Publishing an R package in the Journal of Statistical Software

Published on 24 April 2014

I’ve been an edi­tor of JSS for the last few years, and as a result I tend to get email from peo­ple ask­ing me about pub­lish­ing papers describ­ing R pack­ages in JSS. So for all those won­der­ing, here are some gen­eral comments.

4 Comments  comments 

Seven forecasting blogs

Published on 22 April 2014

There are sev­eral other blogs on fore­cast­ing that read­ers might be inter­ested in. Here are seven worth fol­low­ing: No Hes­i­ta­tions by Fran­cis Diebold (Pro­fes­sor of Eco­nom­ics, Uni­ver­sity of Penn­syl­va­nia). Diebold needs no intro­duc­tion to fore­cast­ers. He pri­mar­ily cov­ers fore­cast­ing in eco­nom­ics and finance, but also xkcd car­toons, graph­ics, research issues, etc. Econo­met­rics Beat by Dave Giles. Dave is a pro­fes­sor of eco­nom­ics at the Uni­ver­sity of Vic­to­ria (Canada), for­merly from my own depart­ment at Monash Uni­ver­sity (Aus­tralia), and a native New Zealan­der. Not a lot on fore­cast­ing, but plenty of inter­est­ing posts about econo­met­rics and sta­tis­tics more gen­er­ally. Busi­ness fore­cast­ing by Clive Jones (a pro­fes­sional fore­caster based in Col­orado, USA). Orig­i­nally about sales and new prod­uct fore­cast­ing, but he now cov­ers a lot of other fore­cast­ing top­ics and has an inter­est­ing prac­ti­tioner per­spec­tive. Freakono­met­rics: by Arthur Char­p­en­tier (an actu­ary and pro­fes­sor of math­e­mat­ics at the Uni­ver­sity of Que­bec at Mon­tréal, Canada). This is the most pro­lific blog on this list. Wide rang­ing and tak­ing in sta­tis­tics, fore­cast­ing, econo­met­rics, actu­ar­ial sci­ence, R, and any­thing else that takes his fancy. Some­times in French. No free hunch: the kag­gle blog. Some of the most inter­est­ing posts are from kag­gle com­pe­ti­tion win­ners explain­ing their meth­ods. Energy fore­cast­ing by Tao Hong (for­merly an energy fore­caster for


No Comments  comments