PPC_Intervals with Dates?

Hi! I am plotting time series data alongside posterior predictive draws from a Bayesian time series model using the ppc_intervals() function. To display it nicely, I wanted to change the x-axis to the actual dates of my data, so I tried to pass the array of dates (of Date type in R) into the x parameter of the function. However, it gives me an error saying that x must be numeric. Is there any way to do what I want with the current implementation of the function? Or should this be added as a feature request?

2 Likes

Hi,
sorry for not getting to you earlier, tagging @jonah as he probably knows best, but my guess is that this isn’t currently possible directly. You might be able to achieve a similar effect by overriding the scale, i.e. adding + scale_x_continuous(breaks = numeric_date_values_for_breaks, labels = string_representations_of_dates)

Hope that helps at least a bit.

1 Like