Root-Mean-Square Error routine in Visual Basic

(c) 2013 by Barton Paul Levenson


Language:
Basic

Dialect:
Microsoft Visual Basic Express 2010

Discussion:
This routine finds the root-mean-square error between two data series. You pass it two arrays of double-precision numbers, presumably of equal size, and the array size.


    ' RMSE finds the root-mean-square error of two series.
    Function RMSE(ByVal X() As Double, ByVal Y() As Double, _
    ByVal Num As Integer) As Double
        Dim sum As Double = 0

        For L = 1 To Num
            sum += (X(L) - Y(L)) ^ 2
        Next

        Return Sqrt(sum / Num)
    End Function ' RMSE


Page created:06/29/2013
Last modified:  06/29/2013
Author:BPL