| @@ 44-47 (lines=4) @@ | ||
| 41 | } |
|
| 42 | ||
| 43 | $sum = 0.0; |
|
| 44 | foreach ($x as $index => $xi) { |
|
| 45 | $yi = $y[$index]; |
|
| 46 | $sum += ($xi - $meanX) * ($yi - $meanY); |
|
| 47 | } |
|
| 48 | ||
| 49 | if ($sample) { |
|
| 50 | --$n; |
|
| @@ 89-92 (lines=4) @@ | ||
| 86 | $meanX = Mean::arithmetic($x); |
|
| 87 | $meanY = Mean::arithmetic($y); |
|
| 88 | $sum = 0.0; |
|
| 89 | foreach ($x as $index => $xi) { |
|
| 90 | $yi = $y[$index]; |
|
| 91 | $sum += ($xi - $meanX) * ($yi - $meanY); |
|
| 92 | } |
|
| 93 | } else { |
|
| 94 | // In the case, whole dataset given along with dimension indices, i and k, |
|
| 95 | // we would like to avoid getting column data with array_column and operate |
|