Writing a Regression routine for vb.Net

(Bilal Mussa) #1

I am new to this and the only .Net language i am familiar with is VB.NET. I was wondering if i could get some help with getting started to write a multiple regression routine for vb.net using math.net numerics ?

Thank you,


(Christoph Rüegg) #2

What is unlcear in the Regression docs on how to use the API from VB.Net? What have you tried?

(Bilal Mussa) #3


I am trying to integrate Maths.Net with ExcelDna to create an Excel based regression tool.

I have composed the following which now works. However, I was wondering how I could get it to ignore a variable/column in the XArray if it is collinear with another ?

Public Function Main(ByVal XArray(,) As Double, ByVal YVector(,) As Double) As Object

    Dim XMatrix = Matrix(Of Double).Build.DenseOfArray(XArray)
    Dim YVec = Matrix(Of Double).Build.DenseOfArray(YVector)

    Dim p = XMatrix.QR().Solve(YVec)

    Dim OutputArray(p.RowCount - 1) As Double
    Dim YFitted(YVec.RowCount - 1) As Double
    Dim i, j As Integer

    For i = 0 To p.RowCount - 1
        OutputArray(i) = p(i, 0)

    Main = OutputArray

End Function