public function corrUnits($level, $levelid = null) { $rateUnits = []; $attrition = []; $batches = []; $results = Correlation::getUnits($level, $levelid); foreach ($results as $result) { array_push($batches, $result->batch); $rateUnits[$result->batch] = $result->ratio; $attrition[$result->batch] = $result->dropouts; } return round($this->getCorrelation($rateUnits, $attrition, $batches), 2); }