Python:生成具有趋势的随机时间序列数据(例如周期性、指数衰减等) [英] Python: Generate random time series data with trends (e.g. cyclical, exponentially decaying etc)

查看:58
本文介绍了Python:生成具有趋势的随机时间序列数据(例如周期性、指数衰减等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试生成一些随机时间序列,其趋势包括周期性(例如销售)、指数下降(例如 Facebook 帖子上的点赞数)、指数增加(例如比特币价格)、普遍增加(股票行情)等.我可以生成一般递增/递减的时间序列,如下

I am trying to generate some random time series with trends like cyclical (e.g. sales), exponentially decreasing (e.g. facebook likes on a post), exponentially increasing (e.g. bitcoin prices), generally increasing (stock tickers) etc. I can generate generally increasing/decreasing time series with the following

import numpy as np
import pandas as pd
from numpy import sqrt
import matplotlib.pyplot as plt

vol = .030
lag = 300
df = pd.DataFrame(np.random.randn(100000) * sqrt(vol) * sqrt(1 / 252.)).cumsum()
plt.plot(df[0].tolist())
plt.show()

但我不知道如何产生周期性趋势或指数增长或下降趋势.有没有办法做到这一点 ?

But I don't know how to generate cyclical trends or exponentially increasing or decreasing trends. Is there a way to do this ?

推荐答案

你可能想要评估 TimeSynth

You may want to evaluate TimeSynth

TimeSynth 是一个开源库,用于为*模型测试*生成合成时间序列.该库可以生成规则和不规则时间序列.该架构允许用户将不同的*信号*与不同的架构匹配,从而允许要生成的大量信号.下面列出了可用的 *signals* 和 *noise* 类型."

这篇关于Python:生成具有趋势的随机时间序列数据(例如周期性、指数衰减等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆