Python:生成具有趋势的随机时间序列数据(例如周期性、指数衰减等)

Python: Generate random time series data with trends (e.g. cyclical, exponentially decaying etc)(Python:生成具有趋势的随机时间序列数据(例如周期性、指数衰减等))
本文介绍了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:生成具有趋势的随机时间序列数据(例如周期性、指数衰减等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
Is there a way of group by month in Pandas starting at specific day number?( pandas 有从特定日期开始的按月分组的方式吗?)
Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)