HORA1TO12

# Download errors of different models
load("~/extendDavg/modelsErrorsTotal.RData")
davg.Error <- modelsErrorsTotal
load("~/extendDmax/modelsErrorsTotal.RData")
dmax.Error <- modelsErrorsTotal
load("~/HORA1/modelsErrorsTotal.RData")
H1.Error <- modelsErrorsTotal
load("~/HORA2/modelsErrorsTotal.RData")
H2.Error <- modelsErrorsTotal
load("~/HORA3/modelsErrorsTotal.RData")
H3.Error <- modelsErrorsTotal
load("~/HORA4/modelsErrorsTotal.RData")
H4.Error <- modelsErrorsTotal
load("~/HORA5/modelsErrorsTotal.RData")
H5.Error <- modelsErrorsTotal
load("~/HORA6/modelsErrorsTotal.RData")
H6.Error <- modelsErrorsTotal
load("~/HORA7/modelsErrorsTotal.RData")
H7.Error <- modelsErrorsTotal
load("~/HORA8/modelsErrorsTotal.RData")
H8.Error <- modelsErrorsTotal
load("~/HORA9/modelsErrorsTotal.RData")
H9.Error <- modelsErrorsTotal
load("~/HORA10/modelsErrorsTotal.RData")
H10.Error <- modelsErrorsTotal
load("~/HORA11/modelsErrorsTotal.RData")
H11.Error <- modelsErrorsTotal
load("~/HORA12/modelsErrorsTotal.RData")
H12.Error <- modelsErrorsTotal

# cbind models errors based on type of model
cb <- function(x) {
    cbind(davg.Error[, x], dmax.Error[, x], H1.Error[, x], H2.Error[, x], H3.Error[, 
        x], H4.Error[, x], H5.Error[, x], H6.Error[, x], H7.Error[, x], H8.Error[, 
        x], H9.Error[, x], H10.Error[, x], H11.Error[, x], H12.Error[, x])
}
svmErrorTotal <- cb(1)
colnames(svmErrorTotal) <- paste(-1:12)
rownames(svmErrorTotal) <- c("MAE", "RMSE", "RELE")
lmErrorTotal <- cb(2)
colnames(lmErrorTotal) <- paste(-1:12)
rownames(lmErrorTotal) <- c("MAE", "RMSE", "RELE")
rfErrorTotal <- cb(3)
colnames(rfErrorTotal) <- paste(-1:12)
rownames(rfErrorTotal) <- c("MAE", "RMSE", "RELE")
nnetErrorTotal <- cb(4)
colnames(nnetErrorTotal) <- paste(-1:12)
rownames(nnetErrorTotal) <- c("MAE", "RMSE", "RELE")
linearErrorTotal <- cb(5)
colnames(linearErrorTotal) <- paste(-1:12)
rownames(linearErrorTotal) <- c("MAE", "RMSE", "RELE")
greedErrorTotal <- cb(6)
colnames(greedErrorTotal) <- paste(-1:12)
rownames(greedErrorTotal) <- c("MAE", "RMSE", "RELE")

the colnames names 0,-1 indicates the errors are based on “davg” ,and “dmax” matrixs, 1-12 means From 1oclock to 12 oclock matrix,the rownames are the different types of error measuremen


# svm errors based on different databases
svmErrorTotal
##           -1      0       1       2       3       4       5       6
## MAE  0.09208 0.0987 0.07447 0.07622 0.07522 0.07209 0.07497 0.07334
## RMSE 0.11710 0.1224 0.09712 0.09815 0.09708 0.09268 0.09591 0.09506
## RELE 0.74084 0.7913 0.50196 0.55330 0.54655 0.46203 0.48957 0.49949
##            7       8       9      10      11      12
## MAE  0.06515 0.06388 0.07030 0.06857 0.06248 0.05124
## RMSE 0.08441 0.08394 0.08985 0.08780 0.08359 0.07180
## RELE 0.47811 0.48454 0.53343 0.52193 0.50238 0.39886
# lm errors based on different databases
lmErrorTotal
##           -1       0       1       2       3       4       5       6
## MAE  0.08079 0.08173 0.07962 0.07578 0.07780 0.07887 0.08262 0.07859
## RMSE 0.10202 0.10442 0.10160 0.09764 0.09827 0.09934 0.10401 0.10013
## RELE 0.65338 0.66144 0.50684 0.53158 0.56949 0.47645 0.48130 0.52823
##            7       8       9      10      11      12
## MAE  0.06572 0.06272 0.06195 0.05907 0.05457 0.04681
## RMSE 0.08319 0.08085 0.07825 0.07519 0.07024 0.06186
## RELE 0.45460 0.41340 0.39778 0.36831 0.35064 0.32348
# rf errors based on different databases
rfErrorTotal
##           -1       0       1       2       3       4       5       6
## MAE  0.08097 0.08822 0.07927 0.08421 0.08018 0.07862 0.08104 0.07890
## RMSE 0.09964 0.10685 0.09855 0.10384 0.09830 0.09705 0.09933 0.09771
## RELE 0.62782 0.69214 0.51818 0.62221 0.56291 0.49765 0.50812 0.51563
##            7       8       9      10      11      12
## MAE  0.06828 0.06585 0.06780 0.06515 0.05908 0.04954
## RMSE 0.08401 0.08318 0.08426 0.08145 0.07417 0.06314
## RELE 0.50266 0.46076 0.47962 0.43251 0.37226 0.28732
# nnet errors based on different databases
nnetErrorTotal
##           -1       0       1       2       3       4       5       6
## MAE  0.09769 0.09147 0.07921 0.07715 0.07729 0.07511 0.08004 0.07565
## RMSE 0.12193 0.11601 0.10204 0.09656 0.09593 0.09644 0.10169 0.09621
## RELE 0.70793 0.69444 0.51594 0.49450 0.50210 0.43995 0.47666 0.46658
##            7       8       9      10      11      12
## MAE  0.06287 0.06444 0.06248 0.06277 0.05965 0.04624
## RMSE 0.08006 0.08454 0.07874 0.07999 0.07654 0.06054
## RELE 0.41402 0.41748 0.41008 0.37760 0.30547 0.23695
# linearEnsemble errors based on different database
linearErrorTotal
##           -1       0       1       2       3       4       5       6
## MAE  0.07929 0.08499 0.07493 0.07428 0.07417 0.07315 0.07542 0.07406
## RMSE 0.09939 0.10418 0.09451 0.09224 0.09136 0.09119 0.09467 0.09231
## RELE 0.62142 0.66364 0.48258 0.49708 0.49014 0.44122 0.45416 0.47896
##            7       8       9      10      11      12
## MAE  0.06076 0.06158 0.05955 0.05724 0.05374 0.04256
## RMSE 0.07575 0.07855 0.07546 0.07308 0.06908 0.05561
## RELE 0.39609 0.39384 0.38004 0.34286 0.29366 0.23092
# greedEnsemble errors based on different database
greedErrorTotal
##           -1       0       1       2       3       4       5       6
## MAE  0.08324 0.08791 0.07692 0.07807 0.07674 0.07507 0.07721 0.07566
## RMSE 0.10347 0.10743 0.09682 0.09679 0.09471 0.09360 0.09656 0.09417
## RELE 0.66096 0.69630 0.50630 0.55999 0.52816 0.46839 0.47841 0.49817
##           7       8       9     10      11      12
## MAE  0.0645 0.06191 0.06213 0.0583 0.05455 0.04362
## RMSE 0.0798 0.07936 0.07764 0.0743 0.06974 0.05666
## RELE 0.4684 0.42660 0.42281 0.3680 0.31511 0.24987
measure <- rep(c("MAE", "RMSE", "RELE"), 6)
lmErrorTotal <- as.data.frame(lmErrorTotal)
rfErrorTotal <- as.data.frame(rfErrorTotal)
svmErrorTotal <- as.data.frame(svmErrorTotal)
nnetErrorTotal <- as.data.frame(nnetErrorTotal)
errorTotal <- rbind(lmErrorTotal, rfErrorTotal, svmErrorTotal, nnetErrorTotal, 
    linearErrorTotal, greedErrorTotal)
type <- c(rep("lm", 3), rep("rf", 3), rep("svm", 3), rep("nnet", 3), rep("linear", 
    3), rep("greed", 3))
e <- cbind(errorTotal, type, measure)
en <- reshape(e, idvar = c("type", "measure"), times = names(e[, 1:14]), timevar = "HOUR", 
    varying = list(names(e[, 1:14])), direction = "long")
colnames(en)[4] <- "errorValues"
MAE <- subset(en, measure == "MAE")
RELE <- subset(en, measure == "RELE")
RMSE <- subset(en, measure == "RMSE")
library(lattice)
xyplot(errorValues ~ HOUR, groups = type, data = MAE, type = "l", xlim = c(-1:12), 
    auto.key = list(space = "right"), plot.points = FALSE, main = "MAE")

plot of chunk HORA1TO12.1

xyplot(errorValues ~ HOUR, groups = type, data = RELE, type = "l", auto.key = list(space = "right"), 
    xlim = c(-1:12), main = "RELE")

plot of chunk HORA1TO12.1

xyplot(errorValues ~ HOUR, groups = type, data = RMSE, type = "l", xlim = c(-1:12), 
    auto.key = list(space = "right"), plot.points = FALSE, main = "RMSE")

plot of chunk HORA1TO12.1

From the plot, it can be seen that, by using the “yesterday” data “davg” and “dmax”, the errors are extremly hgih.the errors of models based on 1-5 oclock in the morning are hgih too. Errors decreases suddenly at 6 oclock, and then staying stable between 6 oclock to 10 oclock. At last,decline to the lowest level at 12 oclock at noon. The godness of fit models based on 12 oclock should be better than the ones based on other hours. Generally,the models emsembled(linear ensemble and greedy ensemble) are trained better than the individuls models. by the method of nerual network are best trained among the four artificial intelligent methodologies( svm,nnet,lm,randomForest), linear least squres(lm) trained the worst ones.