See the Wikipedia page on Root-mean-square deviation.

import spire.implicits.DoubleAlgebra
import axle.stats._

Given four numbers and an estimator function, compute the RMSD:

val data = List(1d, 2d, 3d, 4d)
// data: List[Double] = List(1.0, 2.0, 3.0, 4.0)

def estimator(x: Double) = x + 0.2
// estimator: (x: Double)Double

rootMeanSquareDeviation(data, estimator)
// res0: Double = 0.4000000000000002