如何绘制时间序列的互相关矩阵?
我的数据的时间序列表示如下(没有行和列)注释:
L1 L2 L3 L4
t=1 0 1 1 0
t=2 0 1 1 1
t=3 1 0 1 1
t=4 0 1 1 0
我将其读入 R 为:
timeseries = read.table("./test", header=F)
我正在使用互相关函数绘制 L1 的时间序列
ts.plot(timeseries$V1)
并将互相关函数绘制为:
ccf(timeseries$V1, timeseries$V2)
现在,有人可以告诉我吗如何绘制互相关矩阵来显示该函数 L1-L4 的输出?基本上是这样的(在我的例子中,是一个 4x4 的图矩阵):
I have a timeseries representation of my data as follows (without the row and column) annotations:
L1 L2 L3 L4
t=1 0 1 1 0
t=2 0 1 1 1
t=3 1 0 1 1
t=4 0 1 1 0
I am reading this into R as:
timeseries = read.table("./test", header=F)
I am plotting timeseries for L1 using
ts.plot(timeseries$V1)
and plotting the cross-correlation function as:
ccf(timeseries$V1, timeseries$V2)
Now, can someone please tell me how do I plot a cross correlation matrix that shows the output of this function for L1-L4? Basically, something like this (in my case, a 4x4 matrix of plots):
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
似乎还有另一种简单的方法可以做到这一点!
给我一个相关图矩阵。当然,如果需要协方差,还有其他选项可以传递给 acf。
There seems to be another trivial way of doing it!
gives me a matrix of correlation plots. Of course, there are other options that can be passed to
acf
if a covariance is needed.执行此操作的一种简单方法是简单地在绘图设备上创建一个绘图矩阵,并将每个
ccf
绘图逐一放置:但是如果您稍等一下,了解时间序列包的人就会发现更亲密地可能会使用一个可以更好地完成此操作的函数。
A trivial way of doing this is to simply create a matrix of plots on your plotting device and place each
ccf
plot in one by one:But if you wait around a bit, someone who knows the time series packages more intimately may swing by with a function that does this a bit more nicely.
试试这个,其中
M
是 joran 的帖子:Try this where
M
is as in joran's post: