I have to compute the MSE of the value "Td" without packaging. I used a function but I have always the same MSE (see MSE_mod1) for each row (it shouldn't be the same MSE between lines, right?). Do you know why?
Could you help me? :)
Here is my code:
fonction_MSE <- function(tdval, td) {
n<- 8741
diff<- tdval-td
MSEmode1<- (1/n)*sum((diff)^2)
print(round(MSEmode1, digits = 9))
}
MSE_mod1 <- fonction_MSE(meteo_charleroi[, "Td"], meteo_charleroi[, "Td_mod1"])
MSE_mod2 <- fonction_MSE(meteo_charleroi[, "Td"], meteo_charleroi[, "Td_mod2"])
here is the head of my data frame: