double MovingAverage(TVec *Y, const int N, TVec *M, int &Index, const bool Centered = true);
Single moving average.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Y | TVec * | Sample data. |
| 2 | N | const int | Number of elements in period. |
| 3 | M | TVec * | Smoothed data. |
| 4 | Index | int & | Index of first value in smoothed data. |
| 5 | Centered = true | const bool | If true, a centered moving average is perfomed. |
Returns: MSE.
Remarks:
Performs single moving average smoothing on data Y. General equation for moving average smoothing is:
where N indicates number of points in period and X.Length data sample size. When using single moving average smoothing, bear in mind that when used as forecasts for the next period, single moving average is not able to cope with a significant trend.
Declared in Dew::Stats::Units::StatTimeSerAnalysis · Dew.Stats/Units.StatTimeSerAnalysis.h · Cross-compiler