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
When Y has class "mts" #2
Comments
I changed the class(Y)!="matrix" calls to is.vector(Y). That should resolve this issue, let me know if it doesn't. |
Doesn't it make more sense to look for matrix in the class list?
A time series object is not a vector and assume you would want to convert those to a matrix also.
|
Yes, exactly. I agree that !"matrix" %in% class(Y) is better. |
I've updated all is.vector tests to !"matrix" %in% class(Y). These errors should be resolved. |
For me the following code still fails (I've tested both CRAN and github versions): library(BigVAR)
data(Y)
y_st <- apply(Y, 2, FUN = scale)
y_st_ts <- ts(y_st, start = 1, frequency = 1)
model_spec <- constructModel(y_st_ts, p = 1,
struct = "OwnOther",
ownlambdas = TRUE,
gran = 10)
model_est <- BigVAR.est(model_spec) Without |
The line
if(class(Y)!="matrix"){Y=matrix(Y,ncol=1)}
assumes that class(Y) has length 1. However, commonly we have
class(Y)
[1] "mts" "ts" "matrix"
and applying "as.matrix" as suggested in https://arxiv.org/pdf/1702.07094.pdf on page 10 doesn't convert this to have class "matrix" since this is an inherited class from "matrix"...
class(as.matrix(Y))
[1] "mts" "ts" "matrix"
So it leads to a warning when the above "if" statement is called, and worse -- it converts the multivariate ts into a (nrow(Y) * ncol(Y))-by-1 matrix.
The text was updated successfully, but these errors were encountered: