Click or drag to resize

DescriptiveStatisticsArithmeticMeanOrDefaultTSource Method (IEnumerableTSource, FuncTSource, Double, Double, Boolean)

Returns the arithmetic mean of the container's values. http://en.wikipedia.org/wiki/Average#Arithmetic_mean

Namespace:  FinMath.Statistics
Assembly:  FinMath (in FinMath.dll) Version: 2.4.7-0a995bd0ea1854c2c868ec3f8dae606c5777e170
Syntax
C#
public static double ArithmeticMeanOrDefault<TSource>(
	this IEnumerable<TSource> data,
	Func<TSource, double> selector,
	double defaultValue = 0,
	bool checkForAbnormals = false
)

Parameters

data
Type: System.Collections.GenericIEnumerableTSource
Reference to a container object.
selector
Type: SystemFuncTSource, Double
A transform function to apply to each element.
defaultValue (Optional)
Type: SystemDouble
The default value to return of calculation fail.
checkForAbnormals (Optional)
Type: SystemBoolean
Check is array contains NaN values and properly process them.

Type Parameters

TSource
The source data type.

Return Value

Type: Double
The arithmetic mean.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableTSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also