-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interpolation of irregular time series #256
Comments
With only two observations I think there is some issues with computing the variance for the model. |
When When This leads me to the guess, that it is not the variance of the model that causes the problem. However, this is just a guess. In addition, I'm skeptical about the |
I still suspect it is the variance for this particular case, but I'll need to look into it more. The model returned from As for your second question, you can definitely do direct interpolation of specific time stamps. However it depends on the model that you are using. The |
@mitchelloharawild, what would the call to library(tidyverse)
library(tsibble)
library(fable)
df <- data.frame(
key = c(rep('A', 3), rep('B', 3)),
date = yearmonth(as.Date(c('2019-01-01', '2019-02-01', '2019-04-01', '2019-01-01', '2019-02-01', '2019-03-01'))),
value = c(5, 7, 1, 25, 26, 28)
) %>%
as_tsibble(index = date, key = key) %>%
fill_gaps()
df %>%
model(naive = ARIMA(value ~ -1 + pdq(0,1,0) + PDQ(0,0,0))) %>%
interpolate(df)
Error: Problem with `mutate()` input `interpolated`.
✖ no applicable method for 'interpolate' applied to an object of class "null_mdl"
ℹ Input `interpolated` is `map2(naive, new_data, interpolate, ...)`.
Run `rlang::last_error()` to see where the error occurred.
In addition: Warning messages:
1: It looks like you're trying to fully specify your ARIMA model but have not said if a constant should be included.
You can include a constant using `ARIMA(y~1)` to the formula or exclude it by adding `ARIMA(y~0)`.
2: 1 error encountered for naive
[1] Could not find an appropriate ARIMA model.
This is likely because automatic selection does not select models with characteristic roots that may be numerically unstable.
For more details, refer to https://otexts.com/fpp3/arima-r.html#plotting-the-characteristic-roots The df %>%
model(naive = TSLM(value ~ trend())) %>%
interpolate(df)
# A tsibble: 7 x 3 [1M]
# Key: key [2]
key date value
<fct> <mth> <dbl>
1 A 2019 Jan 5
2 A 2019 Feb 7
3 A 2019 Mar 3.29 <- this should be 4
4 A 2019 Apr 1
5 B 2019 Jan 25
6 B 2019 Feb 26
7 B 2019 Mar 28 I'm not confident |
This issue refers to a communicatio with Rob Hyndman started on stackoverflow.
https://stackoverflow.com/questions/61078446/interpolation-of-irregular-time-series-with-r
I'm looking for a way to interpolate irregular time series data where the timestamp is POSIXct (rather than a date).
Rob proposed following solution, which does not seem to work with the example df I created.
Thanks for taking a look again!
The text was updated successfully, but these errors were encountered: