linear regression
Calculation of a linear regression (straight line) using a X,Y data array
AI
Tóm tắt bởi AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Mã nguồn
Public Sub LinRegsngArr(ByRef sng_XArray!(), ByRef sng_YArray!(), _ ByVal lowLimInd&, ByVal uppLimInd&, ByRef Slope!, ByRef YSection!) 'this Code calculates a linear regression 'using the points of two Arrays (X,Y) 'and gives back slope and Y-intersection 'of the straight line Dim sng_XSum!, sng_YSum!, sng_XQuad!, sng_YQuad!, sng_XYProd!, sng_Fract! Dim lng_Index&, ValuesCounts&, sng_Zaehler! ValuesCounts = uppLimInd - lowLimInd + 1 For lng_Index = lowLimInd To uppLimInd sng_XSum = sng_XSum + sng_XArray(lng_Index) sng_YSum = sng_YSum + sng_YArray(lng_Index) sng_XQuad = sng_XQuad + sng_XArray(lng_Index) ^ 2 sng_YQuad = sng_YQuad + sng_YArray(lng_Index) ^ 2 sng_XYProd = sng_XYProd + sng_YArray(lng_Index) * sng_XArray(lng_Index) Next sng_Fract = ValuesCounts * sng_XQuad - sng_XSum ^ 2 Slope = (ValuesCounts * sng_XYProd - sng_XSum * sng_YSum) / sng_Fract YSection = (sng_YSum * sng_XQuad - sng_XSum * sng_XYProd) / sng_Fract End Sub
Bình luận gốc (3)
Được khôi phục từ Wayback Machine