# Time Series Analysis for a Newbie

I am a beginner in time series analysis and machine learning. I have a dataset where I want to analyse and predict a time series data. I have a pollutant variable and four meteorological parameters like humidity and temperature for about a month, hourly data. The websites I found in the internet were numerous with so many approaches that I couldn't get a clue how to begin. To be honest, I want to use time series analysis for my thesis, and there aren't any people here that can help regarding this. That is why I am asking here. I am trying to predict the pollutant variable which is more like a parameter.

A history of what I have achieved so far: I first learnt about the ARIMA model which I was unsuccessful with. I performed an ADF test to check for stationarity which came significant, so that was a relief. The pollutant variable has a trend and a seasonal variation of 4 hours and 24 hours, i.e. daily variation which I understood from the ACF plot, by finding the lags in the ACF plot. The ARIMA model was unsuccessful in detecting any trend or seasonality and gave a straight line, so I moved on. I learned about SARIMA and used the parameters SARIMA(4,1,4)(1,1,1,24) and the prediction fitted well with the test part with an RMSE of 0.03

I actually want to show that my meteorological parameters especially humidity influences the pollutant variable, so I incorporated an exogenous SARIMAX with the exogenous variables as humidity, temperature and pressure and I again got a good prediction with an RMSE OF 0.002 with a lag of one hour which I don't understand. But anyways it made me happy.

The problem is, the scatterplots between the pollutant variable and the weather parameters especially humidity are not good at all for linear regression as R square value is too low. But I don't think they are linearly related.

I also tried the Granger Casuality Test, but the results were unexpected. The humidity values seem to be affected by the pollutant variables at lags 4 and 24 but not the pollutant vs humidity values which only show a significant lag at 4.

Is there any way to show these dependencies? I am trying to compile my results into a thesis form so that I don't understand what things I should include in the write up to support my thesis. Like what tests should I perform, or what things I need to show to make it look complete a little.

• Have you tried a multivariate time sereis? With humidity, temperature and pressure as components alongside the pollutant, you may want to get the relationship between current component and previous values of temperature, pressure and humidity, not just the current ones as it is the case if you consider the extra variables as external regressors Jun 4, 2019 at 14:03
• I thought that SARIMAX was similar to implementing a multivariate time series. If I understood what you advised, then the exog variables in SARIMAX are considered as regressors at the current time? Is it right? Even if I am not able to predict, I am trying to show how the meteorological parameters can influence the pollutant variable. How do I do that? As you said, by comparing the current component with its previous values. Jun 4, 2019 at 14:11

Scatter plots between the original series can often be useful but of more importance is scatter plots conditional on data conditioned for temporal activities. Often one needs to allow for hourly or daily effects (be they stochastic or deterministic ) and latent level shifts/time trends in order to tease out (identify) useful predictor structure for user specified causal variables. https://autobox.com/pdfs/A.pdf and https://autobox.com/pdfs/SARMAX.pdf might be useful to you as you lay out your approach.

Removing seasonality from a dataset where each 24 hour period of a day is normally or bimodally distributed might also be enlightening/informative .

If you post your data in a csv file ,I and others may be able to help you more , time being available.

Rather than machine-learning this could be tagged as statistics-learning !

EDITED AFTER RECEIPT OF DATA (720 HOURLY VALUES FOR 6 SERIES POLLUTANT PLUS 5 METEORLOGICAL SERIES):

I took your data and set up a Transfer Function using 23 hourly indicators and 5 predictor series. shows possible errant values at a number of time points particularly the last 70 values.

The forecast plot for the next 3 days(72 hours) is here

As a snapshot showing the impact of the 5 input series . Only 3 being found significant .

The data matrix is partially presented here and here

AUTOBOX detected a break point in parameters and segmented the data into 552 and 168 sections. The most recent 168 values yielded the following Actual/Fit and Forecast .

The model is presented here and here

Why aren't my variables correlated? should be of interest to you.

• The data is difficult to share actually. I can add an image. Will it work? Jun 4, 2019 at 10:28
• email it to me at [email protected] Jun 4, 2019 at 11:54
• Thanks a lot sir. Done. Jun 4, 2019 at 13:53
• why don't you accept my answer to close the question and/or upvote it if you can.. Jun 6, 2019 at 14:35

Another way to compare forecasts would be to test if the errors between your forecasts. You could use a Clark-West test to compare the residuals. Note that this does not give you any information about causal relationships. The tests only determine whether different variables contain information that is relevant for the prediction.

Of course, this depends on the goal of your work. In the pure prediction business, it is usually more relevant to show that it helps and not why it provides better predictions.

• So what I have to do is, find the difference aka residuals between the predicted values and the original values and use the Wald Test on them? Thanks. I think I understood wha you advised. My actual goal is to show that my x variables have a hand in causing the y variable which I am trying to predict. That is why I used an exogenous SARIMAX. Jun 4, 2019 at 13:58
• It is not a real Wald test but you are right with the idea. ;) Jun 4, 2019 at 14:08