Questions tagged [time-series]

A Time series is a sequence of data points with values measured at successive times (either in continuous time or at discrete time periods). Time series analysis exploits this natural temporal ordering to extract meaning and trends from the underlying data.

Time series data is data with a pattern (“trend”) over time. Quantitative forecasting can be applied when two conditions are satisfied:

  1. numerical information about the past is available;
  2. it is reasonable to assume that some aspects of the past patterns will continue into the future.

Time series data are useful when you are forecasting something that is changing over time (e.g., stock prices, sales figures, profits, etc.). Examples of time series data include:

  • Daily IBM stock prices
  • Monthly rainfall
  • Quarterly sales results for Amazon
  • Annual Google profits

https://www.otexts.org/fpp/1/4

Time series models attempt to make use of the natural one-way ordering of time so that values for a given period will be expressed as a function of past values. This same idea is used in time series forecasting — future values based on past data.

Typically, time series data points are spaced at uniform time intervals.

A time series model will generally reflect the fact that observations close together in time will be more closely related than observations further apart.

As a place to start, take a look at Wikipedia's page on time series. For further reading, refer to the Statsoft website which has an online textbook on time series analysis.

For time series analysis in , consider looking at the Time Series Task View and questions tagged for the zoo package and for the xts package.


Tag usage:

Questions on tag should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis or Data Science, the StackExchange site for Data Science related topics like time series.

15192 questions
74
votes
5 answers

Pattern recognition in time series

By processing a time series graph, I Would like to detect patterns that look similar to this: Using a sample time series as an example, I would like to be able to detect the patterns as marked here: What kind of AI algorithm (I am assuming…
Ali
  • 935
  • 2
  • 9
  • 10
72
votes
6 answers

Pandas: resample timeseries with groupby

Given the below pandas DataFrame: In [115]: times = pd.to_datetime(pd.Series(['2014-08-25 21:00:00','2014-08-25 21:04:00', '2014-08-25 22:07:00','2014-08-25 22:09:00'])) locations = ['HK', 'LDN',…
AshB
  • 745
  • 1
  • 6
  • 7
69
votes
2 answers

How to plot time series in python

I have been trying to plot a time series graph from a CSV file. I have managed to read the file and converted the data from string to date using strptime and stored in a list. When I tried plotting a test plot in matplotlib with the list containing…
Mohanasundar
  • 733
  • 1
  • 5
  • 5
64
votes
6 answers

Is there a powerful database system for time series data?

In multiple projects we have to store, aggregate, evaluate simple measurement values. One row typcially consists of a time stamp, a value and some attributes to the value. In some applications we would like to store 1000 values per second and more.…
Kit Fisto
  • 4,385
  • 5
  • 26
  • 43
62
votes
2 answers

R tick data : merging date and time into a single object

I'm currently working in tick data with R and I would like to merge date and time into a single object as I need to get a precise time object to compute some statistics on my data. Here is how my data looks like: date time …
marino89
  • 899
  • 1
  • 10
  • 16
61
votes
8 answers

Sliding window of M-by-N shape numpy.ndarray

I have a Numpy array of shape (6,2): [[ 0, 1], [10,11], [20,21], [30,31], [40,41], [50,51]] I need a sliding window with step size 1 and window size 3 like this: [[ 0, 1,10,11,20,21], [10,11,20,21,30,31], [20,21,30,31,40,41], …
siamii
  • 23,374
  • 28
  • 93
  • 143
59
votes
9 answers

Insert rows for missing dates/times

I am new to R but have turned to it to solve a problem with a large data set I am trying to process. Currently I have a 4 columns of data (Y values) set against minute-interval timestamps (month/day/year hour:min) (X values) as below: timestamp …
James A
  • 655
  • 2
  • 7
  • 8
57
votes
11 answers

Converting a data frame to xts

I'm trying to convert a data frame to xts object using the as.xts()-method. Here is my input dataframe q: q t x 1 2006-01-01 00:00:00 1 2 2006-01-01 01:00:00 2 3 2006-01-01 02:00:00 3 str(q) 'data.frame': 10…
user442446
  • 1,099
  • 3
  • 12
  • 13
56
votes
2 answers

Pandas Resampling error: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex

When using pandas' resample function on a DataFrame in order to convert tick data to OHLCV, a resampling error is encountered. How should we solve the error? # Resample data into 30min bins bars = data.Price.resample('30min', how='ohlc') volumes =…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
55
votes
8 answers

Compressing floating point data

Are there any lossless compression methods that can be applied to floating point time-series data, and will significantly outperform, say, writing the data as binary into a file and running it through gzip? Reduction of precision might be…
Szabolcs
  • 24,728
  • 9
  • 85
  • 174
54
votes
4 answers

Pandas finding local max and min

I have a pandas data frame with two columns one is temperature the other is time. I would like to make third and fourth columns called min and max. Each of these columns would be filled with nan's except where there is a local min or max, then it…
Mustard Tiger
  • 3,520
  • 8
  • 43
  • 68
54
votes
5 answers

Time Series Decomposition function in Python

Time series decomposition is a method that separates a time-series data set into three (or more) components. For example: x(t) = s(t) + m(t) + e(t) where t is the time coordinate x is the data s is the seasonal component e is the random error…
user3084006
  • 5,344
  • 11
  • 32
  • 41
49
votes
3 answers

Multivariate time series modelling in R

I want do fit some sort of multi-variate time series model using R. Here is a sample of my data: u cci bci cpi gdp dum1 dum2 dum3 dx 16.50 14.00 53.00 45.70 80.63 0 0 1 6.39 17.45 16.00 64.00 …
Karl
  • 5,573
  • 8
  • 50
  • 73
49
votes
4 answers

R data.table sliding window

What is the best (fastest) way to implement a sliding window function with the data.table package? I'm trying to calculate a rolling median but have multiple rows per date (due to 2 additional factors), which I think means that the zoo rollapply…
alan
  • 4,247
  • 7
  • 37
  • 49
48
votes
2 answers

How to predict time series in scikit-learn?

Scikit-learn utilizes a very convenient approach based on fit and predict methods. I have time-series data in the format suited for fit and predict. For example I have the following Xs: [[1.0, 2.3, 4.5], [6.7, 2.7, 1.2], ..., [3.2, 4.7, 1.1]] and…
Roman
  • 124,451
  • 167
  • 349
  • 456