0
votes

I have one table with two columns DATE and Q.

DATE        Q
--------------------
2013-01-04  932
2013-01-05  409
2013-01-08  511
2013-01-11  121
2013-01-12  252
2013-01-13  201
2013-01-14  40
2013-01-15  66
2013-01-17  NA
2013-01-18  123



Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   10 obs. of  2 variables:
 $ DATE: POSIXct, format: "2013-01-04" "2013-01-05" "2013-01-08" "2013-01-11" ...
 $ Q: num  932 409 511 121 252 201 40 66 NA 123 ..

You can see from data, there is a irregular frequency.First column have data which are converted into date format and in the second column data is numeric. So my intention is to convert this table into times series object, for further projections with forecast package.

So can anyone help me with some code to convert this table into ts object?

1
To my knowledge, the ts() function requires your data to have a specific frequency. For irregular time series, I highly recommend you look into the new tsibble package first and then into the fable package for forecasting. Both packages are co-developed by the same author as the forecast package. - Rob J. Hyndman). pkg.earo.me/tsibbleSavedByJESUS
I already convert with tsibble package.So now I have tsiblle object.This mean I have one column with irregular frequency and second column with some figures Q. So now question is how to put this with this irregular frequency in auto.arima ?j235
ARIMA models were designed for evenly spaced time series, which means that you cannot fit such a model to your data (which is irregular). I encourage you to look into the Kalman filter or any irregularly space time series model.SavedByJESUS

1 Answers

1
votes
time <- seq(as.Date("2018-1-1"),as.Date("2019-1-1"),by=1)
df <- data.frame(Time=Time)
output <- dplyr::left_join(df,YOUR_TABLE,by="DATE")

Your table should have date column by name "DATE". So now you have NA values when your data is missing and you can transform your data to time series. I dont know if it this would help, for me sometimes it does. Maybe tackle NA problem with some replacing method.