简体   繁体   中英

Holt-Winters method in R

In R forecast package there is function hw with parameters beta and gamma.

What is the difference between not invoking the parameters vs assigning them NULL ?

What would be difference between

  1. hw(Data, initial = "optimal", h=24, beta=NULL, gamma=NULL)

  2. hw(Data, initial = "optimal", h=24, gamma=NULL)

In R, arguments to functions can have default values. Such arguments need not be specified explicitly while calling the function. You can find the default values for the arguments to a function by looking at its help page.

You can invoke the help for a function (say f1 ) by running the command ?f1 . Here is a line from the help page of hw :

hw(y, h=2*frequency(x), seasonal=c("additive","multiplicative"),
   damped=FALSE, level=c(80,95), fan=FALSE,
   initial=c("optimal","simple"), exponential=FALSE,
   alpha=NULL, beta=NULL, gamma=NULL, phi=NULL,
   lambda=NULL, biasadj=FALSE, x=y, ...)

This shows that the default values for the beta and gamma arguments are NULL. Hence the two statements hw(Data, initial = "optimal", h=24, beta=NULL, gamma=NULL) and hw(Data, initial = "optimal", h=24, gamma=NULL) are identical.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM