Reputation: 31
When I am trying to run
sarima(log(AirPassengers),0,1,1,0,1,1,12)
It returns
Error in sarima(log(AirPassengers), 0, 1, 1, 0, 1, 1, 12) : unused arguments (1, 1, 12)
The dataset is under the package of astsa
package. The data type is ts
type.
class(AirPassengers)
[1] "ts"
I don't know the reason of this error. I ran the same code in DataCamp, it works.
Upvotes: 0
Views: 1266
Reputation: 50718
A few general comments:
arima
function; there is really no need to load an additional package for fitting basic SARIMA models.AirPassengers
dataset is part of base R, not part of astsa
.In arima
, you specify the non-seasonal and seasonal parameters through function arguments order
and seasonal
, respectively. You can find detailed information what arguments the function takes if you type ?arima
into an R terminal.
For example, to specify a SARIMA(0,1,1)(0,1,1)12 model you do
arima(log(AirPassengers), order = c(0,1,1), seasonal = list(order = c(0,1,1), period = 12))
Note that the seasonal
argument is a list
with the two elements order
(denoting the order of seasonal AR terms, order of seasonal differencing, and order of seasonal MA terms) and period
.
The error you're seeing with astsa::sarima
seems to stem from too many arguments; check that you really have 3 non-seasonal arguments, 3 (optional) seasonal arguments, and one (optional) period.
Above model would be
sarima(log(AirPassengers), 0, 1, 1, 0, 1, 1, 12)
which produces the same fit results as arima
(in fact sarima
just calls arima
"under the hood").
Upvotes: 1