Learn R Programming

flexCountReg (version 0.1.1)

rmse: Calculate Root Mean Squared Error (RMSE)

Description

This function calculates the Root Mean Squared Error (RMSE) between observed and predicted values.

Usage

rmse(y, mu)

Value

Numeric value representing the RMSE.

Arguments

y

Numeric vector representing the observed values.

mu

Numeric vector representing the predicted values.

Details

The RMSE is calculated using the formula: $$RMSE = \sqrt{\frac{1}{n} \sum_{i=1}^{n} (y_i - \mu_i)^2}$$ Where \(y\) is the vector of observed values and \(\mu\) is the vector of predicted values.

Examples

Run this code
y <- c(1, 2, 3)
mu <- c(1.1, 1.9, 3.2)
rmse(y, mu)

Run the code above in your browser using DataLab