Closed danfer21 closed 2 years ago
Can you please provide an example code with the testdata set and some artifically data in Ex to reproduce the error?
Then I am happy to look into this.
Sure, here it goes:
tempEx = as.matrix(eerData$US[,'poil']) colnames(tempEx) = "EA.poil" model.1<-bgvar(Data=eerData, W=W.trade0012, Ex=tempEx, draws=100, burnin=100, plag=1, prior="NG", hyperpara=NULL, SV=TRUE, thin=1, trend=TRUE, hold.out=0, eigen=1 )
Thank you
Hi,
thanks for spotting the bug. I've fixed and the new version is on GitHub. We just updated the package to version 2.4.3, thus it will be included in the next package version on CRAN which will only be updated in a few months.
library(BGVAR)
set.seed(123)
data(eerData)
# as matrix
tempEx = as.matrix(eerData$US[,'poil'])
colnames(tempEx) = "EA.poil"
model.1<-bgvar(Data=eerData,
W=W.trade0012,
Ex=tempEx,
draws=200,
burnin=200,
plag=1,
prior="NG",
hyperpara=NULL,
SV=TRUE,
thin=1,
trend=TRUE,
hold.out=0,
eigen=TRUE
)
# as list
tempEx <- list(tempEx); names(tempEx)<-c("EA")
colnames(tempEx$EA)<-"poil"
model.1<-bgvar(Data=eerData,
W=W.trade0012,
Ex=tempEx,
draws=200,
burnin=200,
plag=1,
prior="NG",
hyperpara=NULL,
SV=TRUE,
thin=1,
trend=TRUE,
hold.out=0,
eigen=TRUE
)
Please note that I've adjusted the eigen
argument from being equal to one to TRUE
(this implies a value of 1.05).
Hope this works for you now!
Thanks a lot for the quick resolution!
However, I see that when hold.out > 0 it stills throws an error:
cbind(Xraw, Exraw): the number of rows of both matrices must be equal
Oh thank you for spotting this! The devil is in the details :-) should be fixed now!
It works!. Thank you very much
When we include a list or matrix of exogenous variables, we get the following error:
[1] "Error in cbind(X, Exraw) : object 'X' not found\n" attr(,"class") [1] "try-error" attr(,"condition") <simpleError in cbind(X, Exraw): object 'X' not found> Error in .BVAR_linear_wrapper(cc = cc, cN = cN, xglobal = xglobal, gW = gW, :
It seems the error comes from the function .BVAR_linear_R, at the line: if (texo) Xraw <- cbind(X, Exraw)
because X has not been defined before. So we need a definition for X.