出了点问题;丢失了所有Rsquared指标值 - 插入符号时间片

时间:2018-05-29 22:53:45

标签: r regression r-caret

我有一个数据集,我正在尝试使用插入符号包中的timeslice参数对滚动预测源进行线性回归和交叉验证。

model_data <- structure(list(date = structure(c(17536, 17543, 17550, 17557, 
17564, 17571, 17578, 17585, 17592, 17599, 17606, 17613, 17627, 
17634, 17641, 17648, 17655, 17662, 17669, 17676), class = "Date"), 
    X_VIX = c(2.2213750375685, 2.31845844215034, 2.42214432805168, 
    2.40514168131914, 2.85128431141804, 3.36936262373057, 2.9683610253704, 
    2.80275413657151, 2.97501923195645, 2.68375750853317, 2.76000994003292, 
    3.2136622980244, 3.06758771065442, 2.8570447537801, 2.8261294299261, 
    2.73501664933202, 2.69259809654329, 2.53765721517353, 2.59674613154354, 
    2.58173083442354), SPY = c(5.60701205088108, 5.62333630310206, 
    5.63225572417907, 5.65402063155967, 5.61440913588427, 5.56243719680005, 
    5.60587746051261, 5.61171885108039, 5.59101157722328, 5.62674867567328, 
    5.61385781089189, 5.55315331809212, 5.55960413149059, 5.58029568095444, 
    5.58578686015654, 5.58559935147548, 5.58357145257487, 5.60892221562235, 
    5.60333574433455, 5.60635336283354), bamlc0a2caa = c(-0.59783700075562, 
    -0.63487827243597, -0.616186139423817, -0.63487827243597, 
    -0.673344553263766, -0.579818495252942, -0.527632742082372, 
    -0.510825623765991, -0.446287102628419, -0.430782916092454, 
    -0.385662480811985, -0.328504066972036, -0.342490308946776, 
    -0.385662480811985, -0.415515443961666, -0.400477566597125, 
    -0.371063681390832, -0.400477566597125, -0.415515443961666, 
    -0.400477566597125)), .Names = c("date", "X_VIX", "SPY", 
"bamlc0a2caa"), row.names = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 
9L, 10L, 11L, 12L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L), class = "data.frame")

    myTimeControl <- trainControl(method='timeslice',
                                  initialWindow = 5,
                                  horizon = 1,
                                  fixedWindow = FALSE)

    lm.mod <- train(bamlc0a2caa ~ . -date,
                    data = model_data, method = 'lm',
                    trControl = myTimeControl, metric='Rsquared')        
    lm.mod

列车功能始终返回与NA R平方值相同的错误。我的代码中没有NA值,n&gt; p参数。我是新的插入包,所以非常感谢任何帮助解决问题。谢谢!

Something is wrong; all the Rsquared metric values are missing:
      RMSE            Rsquared        MAE         
 Min.   :0.04848   Min.   : NA   Min.   :0.04848  
 1st Qu.:0.04848   1st Qu.: NA   1st Qu.:0.04848  
 Median :0.04848   Median : NA   Median :0.04848  
 Mean   :0.04848   Mean   :NaN   Mean   :0.04848  
 3rd Qu.:0.04848   3rd Qu.: NA   3rd Qu.:0.04848  
 Max.   :0.04848   Max.   : NA   Max.   :0.04848  
                   NA's   :1                      
Error: Stopping
In addition: Warning message:
In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo,  :
  There were missing values in resampled performance measures.

0 个答案:

没有答案