CARET中时间片方法的模型解释



假设您想评估一个简单的glm模型来预测经济数据系列。考虑下面的代码:

library(caret)
library(ggplot2)
data(economics)
h <- 7
myTimeControl <- trainControl(method = "timeslice",
                              initialWindow = 24*h,
                              horizon = 12,
                              fixedWindow = TRUE)
fit.glm <- train(unemploy ~ pce + pop + psavert,
                    data = economics,
                    method = "glm",
                    preProc = c("center", "scale","BoxCox"),
                    trControl = myTimeControl)

假设列公式中使用的协变量是对其他模型得到的值的预测。这个简单的模型给出了以下结果:

Generalized Linear Model 
574 samples
3 predictor
Pre-processing: centered (3), scaled (3), Box-Cox transformation (3) 
Resampling: Rolling Forecasting Origin Resampling (12 held-out with a fixed   
window) 
Summary of sample sizes: 168, 168, 168, 168, 168, 168, ... 
Resampling results:
RMSE      Rsquared 
1446.335  0.2958317

除了得到不好的结果(这只是一个例子)。我想知道这是否正确:

  1. 将上述结果视为在整个数据集上由仅使用24*h=24*7个样本训练并在每个视界=12个样本后重新训练的GLM获得的结果
  2. 当地平线从1增长到12时,如何评估RMSE(如这里报道的http://robjhyndman.com/hyndsight/tscvexample/)?

如果我show fit。我得到:

Call:
NULL
Deviance Residuals: 
  Min       1Q   Median       3Q      Max  
-5090.0  -1025.5   -208.1    833.4   4948.4  
Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)  7771.56      64.93 119.688  < 2e-16 ***
pce          5750.27    1153.03   4.987 8.15e-07 ***
pop         -1483.01    1117.06  -1.328    0.185    
psavert      2932.38     144.56  20.286  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for gaussian family taken to be 2420081)
Null deviance: 3999514594  on 573  degrees of freedom
Residual deviance: 1379446256  on 570  degrees of freedom

AIC: 10072
Number of Fisher Scoring iterations: 2 

显示的参数是指最后训练的GLM还是"平均"参数?我希望我讲得够清楚了。

这种重采样方法和其他方法一样。RMSE使用训练数据的不同子集来估计。注意它写的是"Summary of sample sizes: 168, 168, 168, 168, 168, 168, ..."。最终模型使用训练数据集的所有。

Rob的结果和这些结果之间的差异主要是由于平均绝对误差(MAE)和均方根误差(RMSE)之间的差异

最新更新