[英]NAs in y in Statistical Analysis
我的以下代码有问题:
return1 = diff(log(bist))
return1[,1] <- na.locf(return1[,1],na.rm = F)
当我运行Dickey–Fuller测试时,出现以下错误:
df.test <- ur.df(return1, type =c("drift"),lags = 0 )
ur.df(返回1,类型= c(“漂移”),滞后= 0)中的错误:y中的NAs。
您知道如何解决该错误吗?
我猜这是由于您的数据以及由于log. If the first elements in
而导致的NA
的分布log. If the first elements in
log. If the first elements in
return1 are missing then they will not be filled in with
log. If the first elements in
are missing then they will not be filled in with
na.locf` are missing then they will not be filled in with
。
如果将代码的第一部分更改为
return1=diff(log(bist))
return1[,1]<-na.locf(return1[,1],na.rm = TRUE)
那么您将删除第一个缺少的元素。 不过,不确定如何与ur.df
测试匹配。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.