srlanalytics / bdfm

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

Allow argument 'newdata' in predict method #62

Closed srlanalytics closed 5 years ago

srlanalytics commented 5 years ago

predict method now allows for the argument newdata. Because we've already estimated the model (and we use an efficient C++ disturbance smoother) results are (more or less) instant. An example:


library(bdfm)
Y <- econ_us
m <- dfm(data = econ_us[1:300,], factors = 3, pre_differenced = "A191RL1Q225SBEA", store_idx = "A191RL1Q225SBEA")
out_samp <- predict(m, newdata = econ_us[301:469,])

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

codecov-io commented 5 years ago

Codecov Report

Merging #62 into master will decrease coverage by 0.73%. The diff coverage is 48%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #62      +/-   ##
==========================================
- Coverage   60.87%   60.14%   -0.74%     
==========================================
  Files           9        9              
  Lines        1526     1563      +37     
==========================================
+ Hits          929      940      +11     
- Misses        597      623      +26
Impacted Files Coverage Δ
R/auto_process.R 100% <100%> (ø) :arrow_up:
R/dfm-methods.R 3.22% <7.69%> (+0.52%) :arrow_up:
src/BDFM.cpp 71.42% <83.33%> (+0.03%) :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 4b2ae3c...e91da69. Read the comment docs.

srlanalytics commented 5 years ago

@christophsax --- OK if I merge this? I'd like to get it in there before doing anything new!

christophsax commented 5 years ago

Sure, just merged it