Closed srlanalytics closed 5 years ago
Adressed by the adjusted()
function:
library(tsbox)
library(bdfm)
dta0 <- ts_seas(cbind(mdeaths, fdeaths)) # seasonally adjust
dta <- dta0
dta[1:10, 2] <- NA
m <- dfm(dta)
ts_plot(predict(m)[, 'fdeaths'], dta0[, 'fdeaths'])
ts_plot(adjusted(m)[, 'fdeaths'], dta0[, 'fdeaths'])
Created on 2019-06-15 by the reprex package (v0.2.1)
I included an example at the end of the us_gdp.R example of filling in missing values. This is already the default behavior when series are differenced; level observations are left as the observed values in the output
values
and missing values are filled in using estimated differences. For series that were not differenced (i.e. stationary series), however,values
contains only estimated values. If our dfm object is calledest
and our raw data isdata
then we can fill in missing values in data as:Note that if we have specified forecast periods (say
forecast = 3
) thenest$values
will have more rows thandata
(3 in this case). Thus to fill in missing values in data we would want to use something likeTo make things easier for filling in missing values I've set the default
forecast = 0
.