Basic-Excel-R-Toolkit icon indicating copy to clipboard operation
Basic-Excel-R-Toolkit copied to clipboard

R Forecast Functions in Excel

Open nafta90 opened this issue 5 years ago • 1 comments

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

nafta90 avatar Jan 23 '20 17:01 nafta90

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 :)

edugca avatar Apr 22 '21 23:04 edugca