srlanalytics / bdfm

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

Alternative identification does not work #75

Closed christophsax closed 5 years ago

christophsax commented 5 years ago
library(bdfm)

  # works
  m <- dfm(cbind(mdeaths, fdeaths), identification = "pc_long")
  m <- dfm(cbind(mdeaths, fdeaths), identification = "pc_wide")

  # should work?
  m <- dfm(cbind(mdeaths, fdeaths), identification = "mdeaths")
#> Error in PrinComp(Y[, ID], m): Not a matrix.
  m <- dfm(cbind(mdeaths, fdeaths), identification = 1)
#> Error in PrinComp(Y[, ID], m): Not a matrix.
  m <- dfm(cbind(mdeaths, fdeaths), identification = "pc_sub")
#> 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'

Created on 2019-06-23 by the reprex package (v0.2.1)

SethOttoQuant commented 5 years ago

OK, should all work now. Note that I have removed "pc_sub" as a valid identification method. Options are now "pc_long", "pc_wide", or user specified. See below:

# should work?
m <- dfm(cbind(mdeaths, fdeaths), identification = "mdeaths") #good now
m <- dfm(cbind(mdeaths, fdeaths), identification = 1) #good now
m <- dfm(cbind(mdeaths, fdeaths), identification = "pc_wide") 
#"pc_sub" no longer a valid identification method. Use "pc_wide" or "pc_long"
christophsax commented 5 years ago

I guess I still have one :-)

 dfm(cbind(mdeaths, fdeaths), identification = 1, method = "pc")
SethOttoQuant commented 5 years ago

Ok... let me look!

SethOttoQuant commented 5 years ago

yep... same bug in the PCdfm.R file as in the bdfm.r file. Should be OK now!

christophsax commented 5 years ago

Nice!