Popular Groups

Hi all. I have custom_index plugin.  I would like to change the "newest groups" in index to show the "poplar groups" (ie. most number in memberhip)

currently i have this  in index.php to show newest group.

    $groups = list_entities('group','',0,4,false, false, false);

-----------------------------------------------------

and i have this in new_index.php (inside my themes folders)

<?php

    if(is_plugin_enabled('groups')){
?>
        <!-- display latest groups -->
        <div class="index_box">
            <h2><?php echo elgg_echo("custom:groups"); ?></h2>
        <?php
                if (!empty($vars['area5'])) {
                    echo $vars['area5'];//this will display groups
                }else{
                    echo "<p><?php echo elgg_echo('custom:nogroups'); ?>.</p>";
                }
            ?>
        </div>

 

How would I show 5 groups with the most number in memberships. Thanks for your time.