function quantile( vector, percent ) {
		var numValues = vector.length,
			id, value;

		// Calculate the vector index marking the quantile:
		id = ( numValues * percent ) - 1;

		// Is the index an integer?
		if ( id === parseInt( id, 10 ) ) {
			// Value is the average between the value at id and id+1:
			value = ( vector[ id ] + vector[ id+1 ] ) / 2.0;
		} else {
			// Round up to the next index:
			id = Math.ceil( id );
			value = vector[ id ];
		}
		return value;
	}
function quantile( vector, percent ) {
		var numValues = vector.length,
			id, value;

		
		id = ( numValues * percent ) - 1;

		
		if ( id === parseInt( id, 10 ) ) {
			
			value = ( vector[ id ] + vector[ id+1 ] ) / 2.0;
		} else {
			
			id = Math.ceil( id );
			value = vector[ id ];
		}
		return value;
	}
function quantile ( vector , percent ) { var numValues = vector . length , id , value ; // Calculate the vector index marking the quantile: id = ( numValues * percent ) - 1 ; // Is the index an integer? if ( id === parseInt ( id , 10 ) ) { // Value is the average between the value at id and id+1: value = ( vector [ id ] + vector [ id + 1 ] ) / 2.0 ; } else { // Round up to the next index: id = Math . ceil ( id ) ; value = vector [ id ] ; } return value ; }
end FUNCTION quantiles() 
FUNCTION: quantile( vector, percent )
Finds a quantile value.

@private
@param {array} vector - 1d array
@param {number} percent - quantile percent [0,1]
@returns {number} quantile value
end FUNCTION quantiles () FUNCTION : quantile ( vector percent ) Finds a quantile value .