【问题标题】:Is there any method in python like `lag.plot1` in r?python中有没有像r中的`lag.plot1`这样的方法?
【发布时间】:2015-11-15 14:50:27
【问题描述】:

我想在 seaborn 或 statsmodels 中找到一种能够在 r 中生成散点图矩阵为 lag.plot1 的方法。我可以实现一个简单的版本如下:

In [74]: def lag_plot1(x, nrow, ncol):
    ...:     import matplotlib.pyplot as plt
    ...:     fig, axs = plt.subplots(nrow, ncol, figsize=(3*ncol, 3*nrow))
    ...:     for row in range(nrow):
    ...:         for col in range(ncol):
    ...:             offset = row*ncol + col + 1
    ...:             axs[row][col].scatter(x[offset:], x[:-offset], marker='o')
    ...:             axs[row][col].set_ylabel('x(t)')
    ...:             axs[row][col].set_title('x(t-%d)' % offset)
    ...:     return fig
    ...: 

In [75]: lag_plot1(recur, 4, 3)

【问题讨论】:

    标签: python r statsmodels seaborn


    【解决方案1】:

    pandas http://pandas.pydata.org/pandas-docs/stable/visualization.html#lag-plot 中有一个 lag_plot,但它没有绘制不同滞后的图网格,AFAICS。

    statsmodels 没有 lag_plot,但仍有待解决的问题需要添加更多绘图以支持模型诊断。

    【讨论】:

    • 答案应该不仅仅是指向内容的链接
    猜你喜欢
    • 2021-06-09
    • 2019-10-16
    • 1970-01-01
    • 1970-01-01
    • 2017-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多