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 ?
In python, we can plot these trend graphs by using matplotlib. pyplot library. It is used for plotting a figure for the given data.
Practical Data Science using Python Time series is a series of data points in which each data point is associated with a timestamp. A simple example is the price of a stock in the stock market at different points of time on a given day.
You may want to evaluate TimeSynth
"TimeSynth is an open source library for generating synthetic time series for *model testing*. The library can generate regular and irregular time series. The architecture allows the user to match different *signals* with different architectures allowing a vast array of signals to be generated. The available *signals* and *noise* types are listed below."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With