Sage Modeling and Simulation Library

Extensions..::..GetPercentileForItem<(Of <(<'T>)>)> Method (List<(Of <(<'T>)>)>, T, Func<(Of <(<'T, Double>)>)>)

Given a list of source items, a target item of the same type as source items, and a lambda expression that returns a double value (a score) from those items, this function will return a double that is the percentile into which that target value falls for the population represented by the list of source items.

Note1: Percentile is the percent of observed values in the srcItems that fall at or below the value of the targetItem.

Note2: If this operation will be performed repeatedly on the same list, use the other form instead.

Namespace:  Highpoint.Sage.Mathematics
Assembly:  Sage4 (in Sage4.dll)

Syntax


public static double GetPercentileForItem<T>(
	this List<T> srcItems,
	T targetItem,
	Func<T, double> valueGetter
)

Type Parameters

T
The type of items in the list of source items.

Parameters

srcItems
Type: List<(Of <(<'T>)>)>
The source items defining the percentile population.
targetItem
Type: T
The item for whose score we want to know its percentile in the srcItems population.
valueGetter
Type: Func<(Of <(<'T, Double>)>)>
The function that ascertains the value of each source item.

Return Value

The percentile at which the target item falls.