简体   繁体   English

R中的马尔可夫切换VAR中的错误

[英]Error in Markov-switching VAR in R

I'm trying to estimate a Markov-switching VAR in R using the command msvar . 我正在尝试使用命令msvar估计R中马尔可夫切换 VAR These are the first 10 entries of my two time series. 这些是我两个时间序列的前10个条目。 I have 798 . 我有798 When I try to run this I get an Error message 当我尝试运行此程序时,我收到一条错误消息

a <- c(1.998513, 1.995302, 2.030693, 2.122130, 2.236770, 2.314639, 2.365214, 2.455784, 2.530696, 2.596537)
b <- c(0.6421369, 0.6341437, 0.6494933, 0.6760939, 0.7113511, 0.7173038, 0.7250545, 0.7812490, 0.7874657, 0.8275209)
x <- matrix (NA,10,2)
x[,1] <- a
x[,2] <- b
time.seriesx <- ts(x)
markov.switchingx <- msvar(time.seriesx, p = 2, h = 2, niterblkopt = 10)

The error message I get is the following: 我收到的错误消息如下:

Error in optim(par = c(beta0.it), fn = llf.msar, Y = Yregmat, X = Xregmat, : initial value in 'vmmin' is not finite optim中的错误(par = c(beta0.it),fn = llf.msar,Y = Yregmat,X = Xregmat,:'vmmin'中的初始值不确定

Anyone who could help me? 有人可以帮助我吗? Thanks 谢谢

I think that you have to run the log-likehood function first. 我认为您必须首先运行对数似然函数。 I get the same error, but when i did this, it works. 我收到相同的错误,但是当我这样做时,它可以工作。 I'm not sure but i hope this can help you : (I used my data so don't pay attention to "M1euro") 我不确定,但是希望能为您提供帮助:(我使用了我的数据,所以请不要关注“ M1euro”)

library(base)

data <- data.matrix(M1euro, rownames.force = NA)

library(stats)

ss1<-ts(data, frequency=12, start=c(2007,1), end=c(2016,4))

class(ss1)

length(ss1)

ss <- na.approx(ss1,na.rm=F,rule=2)

ss

class(ss)

library(MSBVAR)

require(graphics)

set.seed(1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM