Yana
Yana

Reputation: 975

How to appropriately choose the window for calculating rolling mean and std?

I am checking my data for stationarity. I have a time series with daily data between 1986 and 2019. I would like to know what is the right way to choose the window for the rolling mean and std. I was thinking 252 - the number of business days a year, but I am not sure if this is too big a period.

Upvotes: 0

Views: 1178

Answers (1)

Mohd Naved
Mohd Naved

Reputation: 378

There are various factors to be considered before choosing the correct time time for rolling mean (moving average). First you should have a clear aim (forecasting, smoothing, etc). Mostly people use it for forecasting in stock prices (thus i assume you have daily data for a stock/commodity/trade-able product and you would like to predict its prices using rolling mean.

Check out the seasonality component and how much fluctuation is happening in the data and if by observation you can see that if has a cycle of say 2 months (60 days, or approx 50 working days) then your period of rolling mean should be lesser than it.

In short there is not sure shot formula for finding the period of most suitable rolling mean to be used, and there is subjectivity involved in it.

Upvotes: 2

Related Questions