如何使用 KDB .ml.ts 计算自相关?

How do I calculate the autocorrelation using KDB .ml.ts?

我正在努力学习如何使用 .ml.ts.acfPlot[]。不过,每次我尝试创建一个图时,我都会得到一个宽条,除此之外什么都没有。

我在这里特意使用了 sin[x] 以产生一些有意义的输出。

我做错了什么?

\l ml/ml.q
.ml.loadfile`:init.q
\l ../utils/util.q
\l ../utils/graphics.q

x: til 1000
z: sin 0.1 * x
.ml.ts.acfPlot[z;10;0.8]

我已经针对该项目提出了拉取请求,因为这看起来是一个错误 https://github.com/KxSystems/ml/pull/100

n:til n 已添加以创建每个滞后图

你可以自己测试一下:

\d .ml
ts.acfPlot:{[data;n;width]
  acf:ts.i.autoCorrFunction[data;]each n:til n;
  ts.i.plotFunction[data;acf;n;width;"AutoCorrelation"];
  }
\d .