kosa
kosa

Reputation: 66637

R Forecasting with STL

I am using Rob Hyndman forecasting with STL

fit <- stl(USAccDeaths,s.window="periodic")
forecast(fit)

I am trying to get forecasted numbers (don't want to plot), so I just used forecast(fit), but I couldn't find source for forecast(), there are lot of forecast functions in forecast package source files. I need to understand how these numbers are calculated to match with other implementation I have.

Can someone please help me in pointing to which part of the code will be executed? That helps me in continuing my debugging.

EDIT:

My current understanding is, forecast.R --->forecast.ts will be called and from there

stlf(object,h=h,level=level,fan=fan,lambda = lambda, ...)

should be invoked. Am I correct? If so, where is the source for stlf function located?

Upvotes: 0

Views: 1565

Answers (1)

IRTFM
IRTFM

Reputation: 263331

I don't think that is correct. If you run the example in ?forecast which is what you are showing, then the 'fit'-object is of class-"stl" and so forecast.stl is the underlying function that is called.

stlf is in the namespace of pkg:forecast. Just type the function name (without quotes) at the console.

Upvotes: 2

Related Questions