Calculates the mean square of the model by taking the mean of the
sum of squares between the truth, \(y\), and the predicted, \(\hat{y}\)
at each observation \(i\).
Usage
mse(y, yhat)
Arguments
y
A vector of the true \(y\) values
yhat
A vector of predicted \(\hat{y}\) values.
Value
The MSE in numeric form.
Details
The equation for MSE is:
$$\frac{1}{n}\sum\limits_{i = 1}^n {{{\left( {{y_i} - {{\hat y}_i}} \right)}^2}}$$