Questions tagged [time-series]

3581 questions

0

8

Views

How to stack columns of a time series data in python

I have a dataframe containing time series feature. In that, I would like to stack 5 features from this dataframe, each of shape(129,300). to extract one feature alone I use: Feature=df.iloc[:,start:end] #df is the dataframe containing the complete dataset This retreives me that particular channel o...
hakuna_code

1

47

Views

How to calculate the steepness of a trend in python

I am using the regression slope as follows to calculate the steepness (slope) of the trend. Scenario 1: For example, consider I am using sales figures (x-axis: 1, 4, 6, 8, 10, 15) for 6 days (y-axis). from sklearn.linear_model import LinearRegression regressor = LinearRegression() X = [[1], [4], [6]...
Emi

1

38

Views

ggplot2 for monthly time series data

I have a time series like this one from 1979 to 2018 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 1979 15.414 16.175 16.342 15.447 13.857 12.530 10.311 8.041 7.051 8.748 10.943 13.336 1980 14.862 15.955 16.041 15.429 13.793 12.205 10.100 7.984 7.667 9.183 11...
fonaritm

0

23

Views

How to create a loop on linear regression in Rstudio?

I have data that looks something like this, there is time series data for many Rute over multiple RASK. Rute Year Month RASK Fare A 2017 1 10 38 A 2017 2 9 37 A 2017 3 11 40 A 2017 4 12 42 B 2017 5 13 45 B 2017 6 1...

3

31

Views

Find common ids against all dates python

I have two columns in a dataframe. ID and date. I want to find the IDs that are common for all given dates. There are a lot of ways/solutions to solve this problem. I'm wondering if there is a built-in function in python or pandas or numpy that can do the job for me. Let me show you by example: Date...
Nofy

1

2.6k

Views

R: Deseasonalizing a time series

We can use following code to plot and decompose a time series in R: # Monthly Airline Passenger Numbers 1949-1960 data(AirPassengers) data = data.frame(AirPassengers) data #Transform to time series ts.data1 = ts(data=as.vector(t(data['AirPassengers'])), start = c(1949), end = c(1960), frequency=12)...
Rnaldinho

3

42

Views

R ggplot time series without grid arrange

I have a different time series for example 4. In this case, I simulated 4 white noise time series. timeSeries
TheAvenger

0

12

Views

How to deal with NA's after converting a factor column to date format in a dataset

I have this data, i converted it into date format, Period Product.Group Amount 7 Jan-16 ADSL 150936 9 Jan-16 Data 31534 10 Jan-16 Internet 57086 11 Jan-16 Ka Band 15421 12 Jan-16 Postpaid Voice 1172139 25 Feb-16 ADSL 57870 26 Feb-...
parvel

1

28

Views

Pandas : How to avoid fillna while resampling from hourly to daily data

I have a Series which consists of hourly data. I want to compute daily sum. The data may have missing hours and sometimes missing dates. 2017-02-01 00:00:00 3.0 2017-02-01 01:00:00 4.0 2017-02-01 02:00:00 4.0 2017-02-03 00:00:00 3.0 For example, in the time series above for 2017-02-01, only fir...
Arnab Biswas

3

83

Views

tseries - block bootstrap two series same order of resampling

for example require(tseries) series1
Andrew Bannerman

0

46

Views

How to Convert 6s Power Consumption Time Series Data To 1 Hour Data?

I have a Time Series Data-set that looks like the following: Dates Power 09-11-12 23:40 123 09-11-12 23:40 0 09-11-12 23:40 0 09-11-12 23:40 0 09-11-12 23:40 0 09-11-12 23:40 123 09-11-12 23:40 123 09-11-12 23:40 122 09-11-12 23:40 122 09-11-12 23:41 122 09-11-12 23:41 0 09-11-...
Anisul Islam

1

693

Views

Time series classification using LSTM - How to approach?

I am working on an experiment with LSTM for time series classification and I have been going through several HOWTOs, but still, I am struggling with some very basic questions: Is the main idea for learning the LSTM to take a same sample from every time series? E.g. if I have time series A (with sam...
Andre444

1

89

Views

Time series axis changes in R

I have the following data frame: head(DWPhyto) # A tibble: 6 x 2 date data 1 2008-10-13 200 2 2009-03-25 200 3 2009-05-03 200 4 2009-05-13 200 5 2009-07-20 200 6 2009-12-22 200 str(DWPhyto) Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 1364 obs. of 2 variables: \$ date: Date, form...

0

147

Views

One step ahead forecast out-sample accuracy and residuals

I have a time series my.ts with 30 variables , and a hts object by my.hts= hts(my.ts). The hts has just one level. I have used auto.arima to fit the in-sample data. What I want is the accuracy measures and residuals of one step ahead forecast in out-sample data. I knew that in forecast package, the...
Fung Kwong Kit

1

310

Views

Shading positive and positive areas beyond ZERO line: anomaly in R

Given a standardized time series, I will like to shade positive and negative areas in blue and red colors, respectively. Gaining inspiration from the following post, I tried the following: library (ggplot2) ggplot(b, aes(dates, dat)) + geom_area(data=subset(b, dat=0), fill='blue',position = 'identit...
code123

1

82

Views

Insert rows for missing time (format HH:MM:SS) in R

I am fairly new to R and was trying to determine if I could use R to help fill in missing values in a number of large data sets I am working with. I'll try to explain it to the best of my abilities. The data set I am working with has time data in the format HH:MM:SS. It is irregular in that no two d...
s_meli_m

0

271

Views

R fitted ARIMA off by one timestep? pkg:Forecast

When plotting fitted ARIMA results on the original data, the fitted values sometimes appear off by one timestep: library(forecast) set.seed(1) #simualted ts eg
Chris McCort

1

437

Views

extract coefficient from auto.arima without intercept

I would like to extract the AR coefficients from a few models i created with auto.arima. the problem is that I want to take the sum of the AR coefficients but without the intercept/mean. bsp_ts
yaennu

0

112

Views

Data not getting populated into influxdb but returns status code 204

We are using influxdb in our application and found some rows are getting duplicated for same tags and timestamp. So I deleted all the records for that tag and tried inserting data for that tag again. But I can see data are not getting populated in influx even though I am getting 204 as response. I t...
BkNayak

1

739

Views

Plotting a Time Series in ggplot, with lines grouped by Year

I am trying to plot a time series with years each on different lines. Take this example: library(ggplot2) library(lubridate) library(dplyr) df = data.frame(dt = seq(as.Date('2015/01/01'), by = 'day', length.out = 1000), num = c(sample(1:333), sample(333:665), sample(665:998))) With this sample data,...
Matsutake

1

121

Views

Cross correlatation for time series with weights?

Part 1: Previously I was using the ccf function in R to compute cross correlations between two timeseries ts_1 and ts_2. Now, I want to compute the crosscorrelation, but I have a vector of weights which is the same length as ts_1 and ts_2. From what I understand, the built-in ccf function I was usin...
Jane Sully

1

114

Views

plot multiple XTS timeseries by day only

i have a question with plotting (time series) in R and I hope someone can give me some suggestions: I have an R project (latest version) where i want to compare the river outflow with precipitation and other climate factors. This I want to do by seasons and/or monthes. However, when i want to plot m...
Sascha

1

646

Views

Plot Multicolored Time Series Plot based on Conditional in Python [duplicate]

This question already has an answer here: How to plot multi-color line if x-axis is date time index of pandas 2 answers I have a pandas Financial timeseries DataFrame with two columns and one datetime index. TOTAL.PAPRPNT.M Label 1973-03-01 25504.000 3 1973-04-01 25662.000...
Danish A. Alvi

0

94

Views

Vertically aligning multiple timeseries plots

I've got measurements of several different quantities made during the same range of time. How can I plot them all in the same window, so they're all vertically aligned—that is, so that for any given time t, all the data points for that time have the same x (horizontal) coordinate in the window?...
Ben Kovitz

0

35

Views

How to add dates to remote sensing data?

I am working with remote sensing data to create time series of NDVI and Cloud cover. The data consists of 30 rows (latitude) and 40 columns (Longitude) and 212 matrix slices which are the months from 2000-03 until 2017-10. How ever R sees the data as an array and there is no date visible in the data...
Francis Criens

1

242

Views

Test for Stationarity in time series

I need to check second order stationarity of a time series of length 7320 (I have 1800 such time series). These time series are displacement recorded at 1800 sites on a mountain. I tried using Priestley-Subba Rao in R : stationarity(). For 1 time series out of 1800, I got these values: p-value for T...
Nitika Kandhari

1

232

Views

Aws Dynamo Time Series Read Data

What would be the best way to model a time series data, that needs fast lookup for single items, however writes are not important. columns: Time(PK), value Time will be stored as an Unix timestamp, value as an int. Queries I want to perform: Given a timestamp, find the closest timestamp in table to...
WeCanBeFriends

1

200

Views

Conv1D does not update the weights. (All zero) and Test outputs are always same which is equal to Last layer Weights?

I would like to use 1D CNN to predict next day solar energy. The time series data resolution is one hour and the length is one year. I am training the model with the data of day 1 to predict day 2. xtrain = day1, ytrain = day2, xtest = day3 to predict day4. 24 hour data input -> CNN -> 24 hour outpu...
Reiso

0

129

Views

ValueError when using .diff() with dask dataframe

I have a large time series data set which I want to process with Dask. apart from a few other columns, there is a column called 'id' which identifies individuals and a column transc_date which identifies the date and a column transc_time identifying the time when an individual made a transaction. Th...
jonasus

0

36

Views

How to calculate the attributes of dlm function in R (petris 2009)

Let us consider two functions described by Petris for random walk with Nile data. I would like to know how these attribute values are calculated. I am planning to design the Box Jenkins Airline model on dlm. Could you please provide tips or example code? Thanks. Edit: added the library to be include...
Biswajit Jana

0

149

Views

Result of nnetar is strangely flat

I'm new to R but have some experience with ARIMA models. Now I wanted to learn a bit about neural networks for forecasting. I tried to repeat the procedure from Rob's post. It worked great for the data set he used. It also worked great for imaginary datasets I created. But then I tried to use real-l...

0

64

Views

Time Series Forecasting in Python for Numerous Time Series

I have a network of sensors that output hourly/daily reads. Some of these sensors are faulty and send out reads sporadically (once a week, once a month). The sensors are not connected to one another, but they can be classified. I ran a clustering algorithm to classify them based on their dry param...
sa_zy

0

151

Views

Input dimension mismatch in Keras

Hi Can anyone help me out with the error, I have seemed to search through the documentation but to no avail. The aim is to predict a time series. I have used a dummy data shape = (N, timesteps, features). I wish to predict x_2 from x_1, x_3 from x_2 and so on till x_11 from x_10 using LSTM. (Any sug...
Nilesh Kumar Jha

1

80

Views

Mutiple VAR forecast with optimal lags

I would like to run the code below automatically for 72 columns (the example code below contains only 3 columns). library(fpp2) library(vars) #Make up some Time Series dj1=diff(log(dj)) dj2=diff(log(dj+2)) dj3=diff(log(dj+7)) ###Actual Problem dataframe=as.data.frame(cbind(dj1,dj2,dj3)) # My dat...
DaWassi

0

158

Views

How to train a LSTM Neural Network to forecast a full “cycle” of a Time Series?

I have the below data whose 'cycles' grow in period over time: My goal is to feed some fraction of this into a LSTM network in order to predict or forecast the remaining points (at least enough to make up one full cycle). I've been trying to follow this tutorial: https://machinelearningmastery.com/...
Sam

0

34

Views

Plot by using lines()

here is first few lines of my data > data Price Time 1 116800 2008-03-01 2 117200 2008-04-01 3 125100 2008-05-01 4 125300 2008-06-01 5 128700 2008-07-01 6 132900 2008-08-01 7 133500 2008-09-01 8 133700 2008-10-01 9 122900 2008-11-01 I try to manipulate it as a time series and...
huaweiman

1

35

Views

Subsetting data between specific time points

I have what is hopefully a simple question. I am looking to subset a data set by specific time points. I have data that came in over 24 hour time for a few months. e.g. 1 data point was received at 12:00pm, the next at 13:30pm, the next at 15:00pm etc... Below is an example or producing a data set...
Matt

1

17

Views

create customized transpose of data in python

I have a dataframe like this: ID Month Price Sale sk1 1 100 6 sk1 2 120 7 sk1 3 130 8 sk2 1 50 3 sk2 2 60 4 sk2 3 70 5 Desired output: ID 1_Price 2_Price 3_Price 1_Sale 2_Sale 3_Sale sk1 100 120 130 6 7 8...
muni

1

50

Views

Run multiple groupby operations and different transform functions on a data set

I have the below data set which is a reading of values every 5 seconds. I need to do two operations on the data set. Calculate average value for every minute from the data set Using the above minute average values, calculate hourly variation (i.e difference every minute values and sum total) What wo...
Hemanth V

2

1.2k

Views

How can I predict next value using moving average/rolling mean

I just started exploring time-series. I have such df Volume Year Month 718394219 2013 01 763723622 2014 01 762225057 2015 01 787479774 2016 01 845614054 2017 01 I want to predict the Volume for 2018. The accuracy of the forecast don't need to be high, as I just want to u...
Daniel Chepenko