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