function calculateRegression($project_id, $time, $trend_value)
{
    $trends = getTrendsTimeArray($project_id);
    $times = getTrendsTimeArray($project_id);
    $sx = stats_standard_deviation($times);
    $sy = stats_standard_deviation($trends);
    $r = Corr($x, $y);
    $b = $r * ($sy / $sx);
    $a = $trend_value - $b * $time;
    return $b * $time + $a;
}
Exemple #2
0
function calculateRegression($project_id, $time, $trend_value)
{
    $trends = getTrendsTimeArray($project_id);
    $times = getTrendsTimeArray($project_id);
    $sx = stats_standard_deviation($times);
    $sy = stats_standard_deviation($trends);
    $r = Corr($sx, $sy);
    //removed to check error can be uncomment later.
    //$r = 2;//random value need to remove
    $b = $r * ($sy / $sx);
    $a = $trend_value - $b * $time;
    return $b * $time + $a;
}