Using the VARselect
function in the vars
package of R results in the following error:
Error in lm.fit(x=ys.lagged,y=yendog)
: NA
/NaN
/Inf
is in x
Addition:Warning messages:1:Inlm.fit(x=ys.lagged,y=yendog)
:NA
s introduced by coercion
2:Inlm.fit(x=ys.lagged,y=yendog)
:NA
s introduced by coercion
There are no missing values in the data. Why do I get errors?
I am a beginner in programming, so I would appreciate it if you could let me know if it is a basic error.
How to write a good sample code will give you a better answer.
library(vars)
VARselect (Canada)# No Error
VARselect(iris)# Error (because non-numeric information is included)
is.numeric(Canada)#[1]TRUE
is.numeric(iris)#[1]FALSE
# If you do the following three things, you may know why.
is.numeric(xxx)# Is it all numeric data? (FALSE is bad)
any(is.na(xxx))#NA included or not (TRUE is bad)
any(is.infinite(as.matrix(xxx)))#Inf included (TRUE is bad)
© 2024 OneMinuteCode. All rights reserved.