eval_metrics: Evaluation RMSE for True and Prediction Data

Description Usage Arguments Value Author(s) Examples

View source: R/LinearRegression.R

Description

Compute the RMSE for a given true and prediction data.

Usage

1
eval_metrics(true, predictions)

Arguments

true

true is the vector of true values.

predictions

predictions is the vector of prediction values.

Value

A scalar RMSE

Author(s)

Li (Richard) Liu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (true, predictions)
{
    resids = true - predictions
    resids2 = resids^2
    N = length(predictions)
    RMSE = round(sqrt(sum(resids2)/N), 2)
    return(RMSE)
  }

WeakCha/BIOSTAT625_HW4 documentation built on Dec. 18, 2021, 7:16 p.m.