Where did the "lead" and "pivot" parameters for TSMOVAVG go in the Financial Time Series Toolbox 2.1 (R14)?

조회 수: 1 (최근 30일)
In the Financial Time Series Toolbox 2.0 (R13), the TSMOVAVG function could be used with a "lead" parameter when using the simple averaging method, and a "pivot" parameter when using the weighted averaging method.
In the Financial Time Series Toolbox 2.1 (R14), TSMOVAVG does not allow these parameters.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 6월 27일
The ability to specify the "lead" and "pivot" parameters is not available in the Financial Time Series Toolbox 2.1 (R14).
As a workaround, you can use the TSMOVAVG function in conjunction with the LEADTS function to simulate these options by "shifting" the data in the time series object.
This method uses TSMOVAVG to find the moving average, and then uses LEADTS to associate the resulting data with earlier times. This approach can be used with all the moving average methods, not just the "simple" and "weighted" methods.
For instance, if you create a Financial Time Series as follows:
lead = 1;
lag = 1;
fts = fints([(now + [1 1.5 2 3 3.25 3.75 4 5])' [2 3 5 5 5 5 6 7]']);
Where you previously would have used:
afts = tsmovavg(fts, 's', lead, lag);
Use the following, instead:
afts = tsmovavg(fts, 's', lead + lag + 1);
afts = leadts(afts, lead, NaN);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by