我创建了这个程序来估计均方误差(MSE)和平均绝对百分误差(MAPE):这一切都可以吗?
pune是一个包含22个数据点的.csv文件.
pune <- read.csv("C:/Users/ervis/Desktop/Te dhenat e konsum energji/pune.csv", header=T,dec=",", sep=";")
pune <- data.matrix(pune,rownames.force=NA)
m1 <- seq(from = 14274.19, to = 14458.17, length.out = 10000)
MSE1 <- numeric(length = 10000)
for(i in seq_along(MSE1)) {
MSE1[i] <- 1 / length(pune) * sum((pune-m1[i]) ^ 2)
}
MAPE1 <- numeric(length = 10000)
for(i in seq_along(MAPE1)) {
MAPE1[i] <- 1 / length(pune) * sum(abs((pune-m1[i]) / pune))
}
Run Code Online (Sandbox Code Playgroud)
我对吗?
r ×1