For anyone who is interested, i've created an effective method to get the mode of an array of numbers. Whereas the mean, median and range are relatively easy to find, the mode is difficult because more than one number can be the mode when several numbers are the most and equally frequent.

The method getmodeAverage gets all the numbers in an array and returns an array containing the mode numbers (which could be one or several).

actionscript Code:
public static function getByType(type:Class, source:Array):Array {
    var array:Array = new Array();
    for each(var obj:* in source) {
        if(obj is type) array.push(obj);
    }
    return array;
}

public static function getModeAverage(a:Array):Array {
    var array:Array = a.getByType(Number);
    if(array.length<1) return null;
   
    var groups:Array = new Array();
    var done:Array = new Array();
   
    for each(var x:Number in array) {
        var group:Array = new Array();
        var d:Boolean = false;
        for each(var y:Number in done) if(y == x) d = true;
        if(!d) {
            for each(var z:Number in array) if(z == x) group.push(z);
            groups.push(group);
        }
        done.push(x);
    }
   
    var largestGroups:Array = new Array();
    var maxSize:uint = 0;
    for each(group in groups) if(group.length > maxSize) maxSize = group.length;
   
    var final:Array = new Array();
    for each(group in groups) if(group.length == maxSize) final.push(group[0]);
   
    return final;
}

The code is messy so any improvements would be appriciated.

Thank you

Flos