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