Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

last model fit by cv.BigVAR? #3

Closed
bdemeshev opened this issue Apr 26, 2017 · 2 comments
Closed

last model fit by cv.BigVAR? #3

bdemeshev opened this issue Apr 26, 2017 · 2 comments

Comments

@bdemeshev
Copy link

First, thank you for the package! :)

Why the functions cv.BigVAR and BigVAR.est give different estimates of beta for the same lambda? Or am I missing something with the training sample?

library(BigVAR)

data(Y)
y_st <- apply(Y, 2, FUN = scale)

model_spec <- constructModel(y_st, p = 6, 
                             struct = "OwnOther", 
                             ownlambdas = TRUE,
                             gran = 10, 
                             verbose = TRUE, 
                             VARX = list())

model_cv <- cv.BigVAR(model_spec)
model_est <- BigVAR.est(model_spec)

b11_est <- model_est$B[1, 1, 1]
b11_cv <- model_cv@betaPred[1, 1]

b11_est
b11_cv
@wbnicholson
Copy link
Owner

I looked into this issue. There is no difference in the data across the two scenarios. However, in cv.BigVAR the most recent coefficient matrix for beta as well as the most recent "active set" is used as an initialization whereas in BigVAR.est it starts from a coefficient matrix of zeros. If you remove the initialization by adding the code:

beta <- array(0,dim=c(k,p*k+1,1)) activeset <- rep(list(rep(rep(list(0), length(kk)))), gran2)
before line 877 in BigVARSupportFunctions.R, both functions will return identical results.

As another potential alternative, reducing the optimization tolerance (currently .0001) would decrease this discrepancy.

@bdemeshev
Copy link
Author

That's perfect! I think I will close the issue and open a new one in some minutes ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants