srlanalytics / bdfm

Bayesian dynamic factor model estimation and predictive statistics including nowcasting and forecasting
MIT License
5 stars 6 forks source link

`adjusted`: An adjusted version of `value` #59

Closed christophsax closed 5 years ago

christophsax commented 5 years ago

An adjusted output series with the same values as the original series if available, and with the same diffs as the fitted values predict(m). I.m.O., this is better than just plugin in the missing values. We discussed that back in Zurich.


library(bdfm)
library(tsbox)

md <- mdeaths
md[1:10] <- NA
dta <- ts_c(md, fdeaths)

m <- dfm(dta)

# substituting
md_fill <- md
md_fill[!is.finite(md_fill)] <- predict(m)[1:NROW(md_fill)][!is.finite(md_fill)]

ts_plot(adjusted = m$adjusted[, "md"], substituted = md_fill, true = mdeaths)

Created on 2019-03-24 by the reprex package (v0.2.1)

christophsax commented 5 years ago

still problems, do not merge.

codecov-io commented 5 years ago

Codecov Report

Merging #59 into master will increase coverage by 1.01%. The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #59      +/-   ##
=========================================
+ Coverage   60.09%   61.1%   +1.01%     
=========================================
  Files           9       9              
  Lines        1496    1517      +21     
=========================================
+ Hits          899     927      +28     
+ Misses        597     590       -7
Impacted Files Coverage Δ
R/dfm-methods.R 2.7% <0%> (-0.16%) :arrow_down:
R/dfm.R 53.33% <50%> (-0.12%) :arrow_down:
R/dfm_core.R 69.17% <94.44%> (+4.51%) :arrow_up:
src/BDFM.cpp 71.39% <0%> (+0.56%) :arrow_up:
R/utils.R 13.55% <0%> (+8.47%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 217d744...e446451. Read the comment docs.

christophsax commented 5 years ago

now we are good, ready to merge.