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
24
votes
4 answers

How to plot stacked event duration (Gantt Charts)

I have a Pandas DataFrame containing the date that a stream gage started measuring flow and the date that the station was decommissioned. I want to generate a plot showing these dates graphically. Here is a sample of my DataFrame: import pandas as…
Inkenbrandt
  • 336
  • 2
  • 3
  • 12
24
votes
1 answer

How to perform join over date ranges using data.table?

How to do the below (straightforward using sqldf) using data.table and get exact same result: library(data.table) whatWasMeasured <- data.table(start=as.POSIXct(seq(1, 1000, 100), origin="1970-01-01 00:00:00"), end=as.POSIXct(seq(10, 1000,…
Samo
  • 2,065
  • 20
  • 41
23
votes
1 answer

"non-stationary seasonal AR part from CSS" error in R

I am trying to fit ARIMA model of a seasonally decomposed series. But when I try to execure following: fit = arima(diff(series), order=c(1,0,0), seasonal = list(order = c(1, 0, 0), period = NA)) It gives me following error: Error in…
mihsathe
  • 8,904
  • 12
  • 38
  • 54
23
votes
2 answers

How to use time-series with Sqlite, with fast time-range queries?

Let's say we log events in a Sqlite database with Unix timestamp column ts: CREATE TABLE data(ts INTEGER, text TEXT); -- more columns in reality and that we want fast lookup for datetime ranges, for example: SELECT text FROM data WHERE ts BETWEEN…
Basj
  • 41,386
  • 99
  • 383
  • 673
23
votes
3 answers

Predicting a multiple forward time step of a time series using LSTM

I want to predict certain values that are weekly predictable (low SNR). I need to predict the whole time series of a year formed by the weeks of the year (52 values - Figure 1) My first idea was to develop a many-to-many LSTM model (Figure 2) using…
Lucas Brito
  • 1,028
  • 1
  • 18
  • 36
23
votes
3 answers

pandas df.loc[z,x]=y how to improve speed?

I have identified one pandas command timeseries.loc[z, x] = y to be responsible for most of the time spent in an iteration. And now I am looking for better approaches to accelerate it. The loop covers not even 50k elements (and production goal is…
AltSheets
  • 357
  • 1
  • 3
  • 10
23
votes
2 answers

How to split a pandas dataframe or series by day (possibly using an iterator)

I have a long time series, eg. import pandas as pd index=pd.date_range(start='2012-11-05', end='2012-11-10', freq='1S').tz_localize('Europe/Berlin') df=pd.DataFrame(range(len(index)), index=index, columns=['Number']) Now I want to extract all…
Mannaggia
  • 4,559
  • 12
  • 34
  • 47
23
votes
4 answers

How can I divide single values of a dataframe by monthly averages?

I have the following 15 minute data as a dataframe for 3 years. With the first two columns being the index. 2014-01-01 00:15:00 1269.6 2014-01-01 00:30:00 1161.6 2014-01-01 00:45:00 1466.4 2014-01-01 01:00:00 1365.6 …
Markus W
  • 1,451
  • 5
  • 19
  • 32
23
votes
1 answer

Add Moving average plot to time series plot in R

I have a plot of time series in ggplot2 package and I have performed the Moving average and I would like to add the result of moving average to the plot of time series. Sample of Data-set (p31): ambtemp dt -1.14 2007-09-29…
A.Amidi
  • 2,502
  • 5
  • 25
  • 37
23
votes
5 answers

Reshaping time series data from wide to tall format (for plotting)

I have a data frame containing multiple time series of returns, stored in columns. The first column contains dates, and subsequent columns are independent time series each with a name. The column headers are the variable names. ## I have a data…
medriscoll
  • 26,995
  • 17
  • 40
  • 36
22
votes
2 answers

In R plot arima fitted model with the original series

I was using GRETL. There, when I do the forecasting for the validation of the arima model, I will get the fitted series in blue line and the original series in red line. Later, I switched to R and here I could not find any command to do the same. I…
Pankaj Parag
  • 437
  • 1
  • 6
  • 17
22
votes
3 answers

Why NUMPY correlate and corrcoef return different values and how to "normalize" a correlate in "full" mode?

I'm trying to use some Time Series Analysis in Python, using Numpy. I have two somewhat medium-sized series, with 20k values each and I want to check the sliding correlation. The corrcoef gives me as output a Matrix of auto-correlation/correlation…
John Anderson
  • 223
  • 1
  • 2
  • 4
22
votes
3 answers

Understanding output from statsmodels grangercausalitytests

I'm new to Granger Causality and would appreciate any advice on understanding/interpreting the results of the python statsmodels output. I've constructed two data sets (sine functions shifted in time with noise added) and put them in a "data" matrix…
Wilhelm
  • 363
  • 1
  • 2
  • 7
22
votes
8 answers

C++ time series library (analysis and processing)

I'm looking to get Stack Overflowers' advice and suggestion on time-series libraries written in C++, some of the constraints and requirements for the library: Performance is very critical Capable of handling very large data sets (1 MB - 100 TB…
Matthieu N.
22
votes
6 answers

Python Pandas: Split a time series per month or week

I have a time series that spans a few years, in the following format: timestamp open high low close volume 0 2009-01-02 05:00:00 900.00 906.75 898.00 904.75 15673.0 1 2009-01-02 05:30:00 904.75 907.75 903.75 …
Radar
  • 935
  • 3
  • 9
  • 23