0

I have the following series data. It has 600 data points shown below and i want to generate an array of 100000 elements following the same pattern of the data using Python and i don't know how to do it. Could someone help me to do that?

I tried to plot the histogram and fit the data with some distribution but didn't work so well, because i think my data don't follow any distribution

tup = levy.fit_levy(data)
array = tup[0].get('0')
random = levy_stable.rvs(array[0], array[1],array[2],array[3],size=100000)

Here is the the plot and the histogram of the data i'm trying to fit

Plot

Histogram

2 Answers2

0

The first question here is whether you have (1) time-series or (2) independent samples? If I understand your question I believe you are in the second scenario, in which you need to:

  1. Look for a model that fits your frequency distribution:

I would suggest you start trying different main distributions (looking at your data exponential might be a good starting point). Here you can find a number of continuous distributions in SciPy :

https://docs.scipy.org/doc/scipy/reference/stats.html#continuous-distributions

If you want to automatically find the distribution with the least SSE for your data look at the answer from tmthydvnprt here:

Fitting empirical distribution to theoretical ones with Scipy (Python)?

  1. Sample the model 100000 times

However, if it's time-series data you need to fit a time-series model instead of a frequency distribution. In this case, I suggest you start fitting an ARIMA model and move to more complex ones if this doesn't work: https://www.statsmodels.org/dev/generated/statsmodels.tsa.arima_model.ARIMA.html

Ferran
  • 840
  • 9
  • 18
0

Why don't you do a kernel Smoothing to your data?

I had a list x = [f1, f2,...,f600] looking as yours

enter image description here

Using the KernelSmoothing method of OpenTURNS it was easy to fit a non-parametric distribution:

import openturns as ot
# format x as a sample of 600 points
sample = ot.Sample([[p] for p in x]) 
model = ot.KernelSmoothing().build(sample)

That's it!

enter image description here

Should you want to sample the model 100000 times, just call:

sample_100000 = model.getSample(100000)
Jean A.
  • 291
  • 1
  • 17