【CoefficientRArray】
[code]inputs:IndepArray[MaxSize1]( numericarray ),
DepArray[MaxSize2]( numericarray ),
Size( numericsimple) ;
variables:
var0( 0 ),
var1( 0 ),
var2( 0 ),
var3( 0 ),
var4( 0 ),
var5( 0 ),
var6( 0 ),
var7( 0 ) ;
CoefficientRArray = -2 ;
if Size > 0 then
begin
var0 = 0 ;
var1 = 0 ;
for Value1 = 1 to Size
begin
var0 = var0 + IndepArray[Value1] ;
var1 = var1 + DepArray[Value1] ;
end ;
var0 = var0 / Size ;
var1 = var1 / Size ;
var4 = 0 ;
var2 = 0 ;
var3 = 0 ;
for Value1 = 1 to Size
begin
var6 = IndepArray[Value1] - var0 ;
var5 = DepArray[Value1] - var1 ;
var4 = var4 + Square( var6 ) ;
var2 = var2 + Square( var5 ) ;
var3 = var3 + var6 * var5 ;
end ;
Value2 = var4 * var2 ;
if Value2 > 0 then
begin
var7 = var3 / SquareRoot( Value2 ) ;
condition1 = var7 >= -1 and var7 <= 1 ;
if condition1 then
CoefficientRArray = var7 ;
end ;
end ;
[/code]
页:
[1]