srlanalytics / bdfm

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

Drop Nice Error if Factors > NCOL(data) #60

Closed christophsax closed 5 years ago

christophsax commented 5 years ago
library(bdfm)
dfm(mdeaths, factors = 2, lags = 3, forecast = 3)
#> Error in PrinComp(Y[, long, drop = FALSE], m): Mat::cols(): indices out of bounds or incorrectly used

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

srlanalytics commented 5 years ago

I had put the error message after the call PrinComp(), not before where it should have gone. It gives a more useful error message now:

 #> Error in bdfm(Y = Y, m = m, p = p, Bp = Bp, lam_B = lam_B, Hp = Hp, lam_H = lam_H,  : 
  Number of factors is too great for selected identification routine. Try fewer factors or 'pc_wide'