Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R:Durbin-Watson试验结果为NA_R_Quantitative Finance_Hypothesis Test_Computational Finance - Fatal编程技术网

R:Durbin-Watson试验结果为NA

R:Durbin-Watson试验结果为NA,r,quantitative-finance,hypothesis-test,computational-finance,R,Quantitative Finance,Hypothesis Test,Computational Finance,我试图用R.R.中的Durbin-Watson检验来衡量股票价格历史波动与指数之间的相关性 这就是我到目前为止所做的: data <- read.xlsx("data.xlsx", colNames = TRUE, detectDates = TRUE) data head(data) data$X1 <- as.Date(data$X1) bbva <- xts(data$BBVA, data$X1) ibex <- xts(data$IBEX, data$X1)

我试图用R.R.中的Durbin-Watson检验来衡量股票价格历史波动与指数之间的相关性

这就是我到目前为止所做的:

data <- read.xlsx("data.xlsx", colNames = TRUE, detectDates = TRUE)
data
head(data)
data$X1 <- as.Date(data$X1)

bbva <- xts(data$BBVA, data$X1)
ibex <- xts(data$IBEX, data$X1)

ldbbva <- diff(log(bbva))
ldibex <- diff(log(ibex))
但是当我尝试运行测试
dwtest(回归)
时,这是输出:

    Durbin-Watson test

data:  regression
DW = NA, p-value = NA
alternative hypothesis: true autocorrelation is greater than 0

我已经填充了所有NA值,所以我不明白为什么这是
NA

在Durbin Watson测试中使用
xts
对象有问题。尝试将数据转换为数值向量:

ldbbva <- as.numeric(diff(log(bbva)))
ldibex <- as.numeric(diff(log(ibex)))

ldbbva在Durbin-Watson测试中使用
xts
对象存在问题。尝试将数据转换为数值向量:

ldbbva <- as.numeric(diff(log(bbva)))
ldibex <- as.numeric(diff(log(ibex)))

ldbbva您的数据是什么样子的?你需要给回答者更多的工作机会:你的数据看起来像什么?您需要为回答者提供更多的帮助:
    Durbin-Watson test

data:  regression
DW = NA, p-value = NA
alternative hypothesis: true autocorrelation is greater than 0
ldbbva <- as.numeric(diff(log(bbva)))
ldibex <- as.numeric(diff(log(ibex)))