A function to calculate various error loss functions. Options include: MSE, RMSE, MAE, and MAPE. The default is MSE loss.

loss_function(forecast, observed, metric = "MSE")

Arguments

forecast

numeric: vector of forecasted values

observed

numeric: vector of observed values

metric

string: loss function

Value

numeric test result