如何解释来自robustbase软件包的lmrob警告

时间:2018-12-15 04:41:11

标签: r regression lm

我正在使用功能强大的软件包中的lmrob函数。我收到一些警告消息,不确定如何解释它们。 lmrob在for循环中使用。下面是代码和警告。

warnings

S refinements did not converge (to refine.tol=1e-07) in 200 (= k.max) steps

In lmrob.fit(x, y, control, init = init) :
M-step did NOT converge. Returning unconverged SM-estimate  

代码是

for(i in 1:ncol(core)){
  for(j in 1:ncol(core)){
        if(i == j){
              dat[i,j] = 0
        }else {
              samp = mutate(core,
                            l1 = lag(core[,i]),
                            l2 = lag(core[,j]))
              samp = na.omit(samp)
              predicted = samp[,i]
              explanatory = samp[,j]
              l1 = samp$l1
              l2 = samp$l2
              model = lmrob(predicted ~ explanatory + l1 + l2)
              new_data = data.frame(explanatory = iv[j], l1 = 
  tail(samp$l1,1), l2 =  tail(samp$l2,1))
              pred1 = predict(model, new_data)
              dat[j,i] = round(log(iv[i]/as.numeric(pred1)),2)
        }}
 }

核心对象最初是xts,但是我们将其转换为data.frame

  core = as.data.frame(coredata(xts_object))
  class(core) 
  # "data.frame"

  > str(core)
   'data.frame':    357 obs. of  3 variables:
   $ VNQ: num  0.0744 0.1078 0.1246 0.1426 0.1064 ...
   $ QQQ: num  0.177 0.179 0.171 0.138 0.165 ...
   $ SPY: num  0.1066 0.1105 0.1183 0.0884 0.0981 ...

0 个答案:

没有答案