# Fit a moving average (MA) time series model to the data (R:stats::ar equivalent)

I am looking for some tools for automatic fitting of moving average (MA) time series model to my data in R. I know R:stats::ar method to fit an autoregressive time series model to the data (by default selecting the complexity by AIC) but I keep failing in finding its equivalent for MA model.

There is armaFit method but it requires pre-defining an order of the MA model. I would like to have something that would do it automatically.

• Maybe look at auto.arima in the 'forecast' package? – thebigdog Apr 30 '14 at 7:10

Assuming x is your time series:
library(forecast)