I'd like to ask if there is any R package with a function for calculating and plotting the tracking signal of a time series forecast, supposing that I have a list of real and predicted values.
我想问一下,是否有R包,有一个函数来计算和绘制时间序列预测的跟踪信号,假设我有一个实数和预测值的列表。
I've searched a lot and haven't found anything for R, and I think it would be quite cumbersome and very inefficient to calculate it with loops.
我已经搜索了很多,还没有找到R的任何东西,我觉得用循环来计算它会很麻烦,而且效率很低。
1 个解决方案
#1
0
It is quite easy to compute it manually, without loops :) Suppose your forecast is contained into vector z
and your data are stored in y
:
很容易手工计算它,没有循环:)假设您的预测包含在向量z中,而您的数据存储在y中:
trackingSignal = ifelse(cumsum(abs(z-y))==0, 0, 1:length(z)*cumsum(z - y)/cumsum(abs(z-y)))
#1
0
It is quite easy to compute it manually, without loops :) Suppose your forecast is contained into vector z
and your data are stored in y
:
很容易手工计算它,没有循环:)假设您的预测包含在向量z中,而您的数据存储在y中:
trackingSignal = ifelse(cumsum(abs(z-y))==0, 0, 1:length(z)*cumsum(z - y)/cumsum(abs(z-y)))