R

 

For­get about Excel. It is hope­less for any seri­ous work. (If you need con­vinc­ing, see Bruce McCullough’s arti­cles on Excel.) Any research stu­dent in the quan­ti­ta­tive sci­ences should be using a matrix lan­guage for com­pu­ta­tion. I rec­om­mend stu­dents use R. It is free, has a big user base, and has zil­lions of add-​​on packages.

Rec­om­mended books about R

If you see noth­ing below, try turn­ing off your ad-​​blocker.

See also “Econo­met­rics and R”.

R news

To keep up with every­thing R, sub­scribe to R-​​bloggers.

Blog posts about R

  • Daniel

    Dear,

    I have mete­o­ro­log­i­cal data, a serie of the 24 data for day. I need a serie time graphic, with the days in x axis.
    But in one day with 24 obser­va­tions, understand?

    I try sev­eral form (library “date” “BootPR” …) but with­out sucess.

    The dis­po­si­tion of the data is:
    The day is: dd/​mm/​yyyy
    Day Hr Obs
    01/​01/​2010 00 25,5
    01/​01/​2010 01 26
    01/​01/​2010 02 27
    .
    .
    .
    05/​01/​2010 00 20
    .
    .
    .
    05/​01/​2010 23 19

    Have how you help me?
    I’m brazil­ian and sorry my english

    • http://robjhyndman.com Rob J Hyndman

      Please direct R ques­tions to stats​.stack​ex​change​.com.

    • castet01

      Well, it looks like prob­lem very sim­i­lar to a stock exchange intra­day time-​​series dis­play class problem.

      Should I there­fore sug­gest you to inves­ti­gate stock-​​related packs.

  • castet01

    How to load a bmp pic ?

    I’ve got a geo map in bmp.
    I’d like to load it in R, for dis­play, to be able to click and record geo loca­tions.
    What’s the recipy ?

    As an exam­ple, I am search­ing to per­form in R, what I do with this in mat­lab, I do loadbmp, image, …, ginput:

    % — load %{{{
    sBmp=input( sprintf( ‘>– enter bmp [%s]: ‘, mapBmp));
    if isempty(sBmp), sBmp=mapBmp;end
    sBmp=[ sBmp ‘.bmp’];
    [tab tabM]=loadbmp( sBmp);
    tab=tab(size(tab,1):-1:1,:);
    %}}}

    % — plot %{{{
    figure(4); clg
    colormap(tabM);image( vMap([1 2]),vMap([3 4]), tab); axis(‘xy’);
    set( 4, ‘Posi­tion’, [590 52 751 652]);
    %}}}

    ( … )

    [x y]=ginput

    ——–

    Thx

  • http://robjhyndman.com Rob J Hyndman

    Please send R ques­tions to stats​.stack​ex​change​.com. I do not have time to answer ques­tions here.

  • lan­guage jobs

    Well, this is encour­ag­ing. Good news for me because I haven’t yet mas­tered Excel and I have to admit to get­ting slightly peeved with some of the faults on it — which is prob­a­bly why I gave up on it in the first place.

  • http://designwonen.be Greg Deck­ers

    I recently wrote some basic R tuto­ri­als myself on: R sta­tis­tics. I would really appri­ci­ate it if you could post some ref­er­ence to it somewhere.

    I do find the tuto­ri­als very use­ful for High School and Uni­ver­sity students.

  • caba3233

    I have a daily series with dou­ble sea­son­al­ity (weekly and monthly) and could be used func­tion tbats or bats for pre­dictin … I don t under­stand .how to give the parameters??fit <- tbats(serie1,seasonal.periods=c(7,35)) ? ..

    • http://robjhyndman.com Rob J Hyndman

      7 is cor­rect for weekly pat­terns. But months are of unequal lengths so it is not pos­si­ble to han­dle with Fourier like terms. It is rare to see daily data with a monthly pat­tern. It is much more com­mon to have an annual pat­tern where the sea­son­al­ity is 365.25,

  • Pingback: Forecasting Continued: Using Simulation to Create Prediction Intervals Around Holt-Winters | Analytics Made Skeezy()

  • Andrew

    Dear Rob,
    Is there a sec­tion devoted to updat­ing the fore­cast using pre­dict() with esti­mated para­me­ters? Regards

    • http://robjhyndman.com/ Rob J Hyndman

      I don’t know what this means. pre­dict() is not my func­tion. How is the fore­cast meant to be updated?

      • Andrew

        Dear Rob,

        By update I mean this: a time series has 100 val­ues, I pre­dict value 101… 105. The data is dynamic so I can check if pre­dic­tion 101 is close to the real value when I observe it.… colse or not once the observed value 101 is avail­able I’d like to recal­cu­late the pre­dic­tion of val­ues 102… 105.
        I know it’s not your fuc­tion; predict(x,n.ahead=5) uses the results of your fuc­tion… I just imag­ined you might have some sec­tion in your blog cov­er­ing this topic. If not, thanks anyway!

        • http://robjhyndman.com/ Rob J Hyndman

          ok. No, I haven’t writ­ten on that problem.

  • Fore­caster

    Dear Prof Hyn­d­man, Thank you very much for the fore­cast pack­age in R. This has been very help­ful in my job. I had a ques­tion of Thetaf fore­cast. I tried using Air­Pas­sen­ger exam­ple with thetaf, it just pro­vided a trend line and did not pro­vide sea­sonal fore­cast. Does thetaf detect and fore­cast seasonality ?

    Appre­ci­ate your response.

    • http://robjhyndman.com/ Rob J Hyndman

      The Theta method does not han­dle seasonality.

      • fore­casted

        Thank you Prof Hyn­d­man. On a related note, theta method was one of the best meth­ods and had the low­est MAPE in M3 com­pe­ti­tion. If this method does not han­dle sea­son­al­ity, does this mean that the M3 com­pe­ti­tion did not have any sea­son time series data ?

        I doing some addi­tional research, looks like there is also a vari­ant of theta method called Theta AI (based on neural net­work) which I believe han­dles sea­son­al­ity, I was not sure. Any insight would be greatly appre­ci­ated. I also don’t seem to find this method in any com­mer­cial soft­ware packages.

        • http://robjhyndman.com/ Rob J Hyndman

          Read the M3 paper and find out for yourself.

  • Kelvin Lam

    Hi Prof. Hyndman,

    Thank you for the good work. I have a ques­tion regard­ing set­ting annual sea­son­al­ity to 365.25. Some­times I get an error mes­sage when using tbats() as follows:

    Error in optim(par = param.vector$vect, fn = cal­cLike­li­hoodT­BATS, method = “Nelder-​​Mead”, : func­tion can­not be eval­u­ated at ini­tial parameters

    How­ever, when I switch it to 365.25001 things work just fine. Any insight will be greatly appre­ci­ated! Thanks again.

    • http://robjhyndman.com/ Rob J Hyndman

      Please pro­vide a min­i­mal repro­ducible example.

  • dialpemo

    Hi,

    I would like to know how can I extract the desea­son­al­ized data from the tbats func­tion.
    Kind regards,
    Alejandro

    • http://robjhyndman.com/ Rob J Hyndman

      seasadj()