Basic-Excel-R-Toolkit
Basic-Excel-R-Toolkit copied to clipboard
R Forecast Functions in Excel
Hello,
I have written the following function to return the MAE, MSE & MAPE but when I run it in Excel I get only the first one (MAE).
Forecast.Q <- function(actual, pred){
mae <- mean(abs(actual - pred)) mse <- mean((actual - pred)^2) mape <- mean(abs((actual - pred)/actual))*100
return(c(MAE=mae, MSE=mse, MAPE=mape)) }
How can I get all three? Thanks
I tested your code and I got a vector of 3 values returning to the Excel worksheet. Perhaps, your problem is related to how to deal with array formulas in Excel. In (not-so) older versions of Excel, that kind of formula must be entered with control + shift + enter instead of just enter. Hope that helps :)