Is it at all possible to fit a probability density function to a time series in R (with already existing functions)? I have a large set of time series describing frequencies of Google searches over 60 time points. What I want to do is fit several pdfs to every one of them in a loop with the fitdist() function from package fitdistrplus: Weibull, Inverse Weibull, Lognormal and possibly others.

Of course, this sequence data is ordered and this order gets lost when fitdist() makes a pdf out of the empirical distribution of the search frequency values (which of course then looks completely different than the distribution over time).

Is there a way to use fitdist() in a way that retains the time index? What I did up until now was just map the search frequencies at a time point to frequencies of that time point in a new variable (so: if there are 3 searches at time 2, the value 2 is represented 3 times in this new variable).

But the search frequency data is averaged, so I fear that I will introduce a great deal of bias by mapping to integer counts. Are there any other solutions for fitting time series data to a probability distribution?

P.S.: I know this question is similar to this one, but it is already a year old with no answers and I'm more concerned with how to do it in R specifically.

  • $\begingroup$ How could distribution "retain time index"? You are talking about some kind of model (e.g. regression is a simple example of "normal distributions around linear mean"), but this has nothing to do with fitting distributions. $\endgroup$ – Tim Jun 14 '17 at 15:00
  • $\begingroup$ Questions about how to use R (eg, seeking code / packages) are off topic here. To the extent that there is an on topic statistical question buried here, it seems to be covered by the duplicate. $\endgroup$ – gung - Reinstate Monica Jun 14 '17 at 16:05
  • $\begingroup$ Thank you both for your comments. I wasn't seeking a ready-made solution, just an answer to the question if my method of mapping search frequencies at a time point to frequencies of that time point in a vector and then fitting a distribution to that vector with fitdist() was acceptable for my aims. I've looked into the question on mixture distributions and time series and it answers some aspects of my question. Searching around on CV made me realize that I will probably have to write custom functions to fit the sequential data or indeed use some kid of model for time-dependent data. $\endgroup$ – quadzar Jun 16 '17 at 9:06