【CoefficientREasy】
[code]inputs:Dep( numericseries ),
Len( numericsimple ) ;
variables:
var0( 0 ),
var1( 0 ),
var2( 0 ),
var3( 0 ),
var4( 0 ),
var5( 0 ),
var6( 0 ),
var7( 0 ),
var8( 0 ),
var9( 0 ) ;
CoefficientREasy = -2 ;
if Len > 0 then
begin
var0 = 0.5 * ( Len - 1 ) ;
var1 = 0 ;
for var8 = 0 to Len - 1
begin
var1 = var1 + Dep[var8] ;
end ;
var1 = var1 / Len ;
var4 = 0 ;
var2 = 0 ;
var3 = 0 ;
for var8 = 0 to Len - 1
begin
var6 = Len - 1 - var8 - var0 ;
var5 = Dep[var8] - var1 ;
var4 = var4 + Square( var6 ) ;
var2 = var2 + Square( var5 ) ;
var3 = var3 + var6 * var5 ;
end ;
var9 = var4 * var2 ;
if var9 > 0 then
begin
var7 = var3 / SquareRoot( var9 ) ;
condition1 = var7 >= -1 and var7 <= 1 ;
if condition1 then
CoefficientREasy = var7 ;
end ;
end ;
[/code]
页:
[1]