### Install LinqStatistics via NuGet Source: https://context7.com/dkackman/linqstatistics/llms.txt Use the .NET CLI to add the library to your project. ```bash dotnet add package LinqStatistics ``` -------------------------------- ### ToString() Overloads Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.Range-1.html Provides different ways to get a string representation of a Range object. ```APIDOC ## ToString() ### Description Returns a string representation of the range. ### Method `public override readonly string ToString()` ### Returns - **string** - A string representation of the range. ## ToString(IFormatProvider) ### Description Returns a string representation of the range using a specified format provider. ### Method `public readonly string ToString(IFormatProvider provider)` ### Parameters - **provider** (IFormatProvider) - The format provider to use. ### Returns - **string** - A string representation of the range. ## ToString(string) ### Description Returns a string representation of the range using a specified format. ### Method `public readonly string ToString(string format)` ### Parameters - **format** (string) - The format to use. ### Returns - **string** - A string representation of the range. ## ToString(string, IFormatProvider) ### Description Returns a string representation of the range using a specified format and format provider. ### Method `public readonly string ToString(string format, IFormatProvider formatProvider)` ### Parameters - **format** (string) - The format to use. - **formatProvider** (IFormatProvider) - The format provider to use. ### Returns - **string** - A string representation of the range. ``` -------------------------------- ### Bin Class Methods Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.Bin.html Details of the methods available for the Bin class. ```APIDOC ## Contains(double) ### Description Determines if a value is contained within the segment. ### Method GET ### Parameters #### Path Parameters - **item** (double) - Required - The item to check ### Returns - **bool** - True if item is contained in the range - taking into account MaxInclusive. ``` ```APIDOC ## Equals(Bin) ### Description Checks if this Bin is equal to another Bin object. ### Method GET ### Parameters #### Path Parameters - **other** (Bin) - Required - The Bin object to compare with. ### Returns - **bool** - True if the Bins are equal, false otherwise. ``` ```APIDOC ## Equals(object) ### Description Checks if this Bin is equal to another object. ### Method GET ### Parameters #### Path Parameters - **obj** (object) - Required - The object to compare with. ### Returns - **bool** - True if the objects are equal, false otherwise. ``` -------------------------------- ### Bin Class Constructors Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.Bin.html Details of the constructors available for the Bin class. ```APIDOC ## Bin(double, double, double, int, bool) ### Description Initializes a new instance of the Bin class. ### Method Constructor ### Parameters #### Path Parameters - **v** (double) - Required - Representative value for the Bin - **min** (double) - Required - The minimum value of the Range - **max** (double) - Required - The maximum value of the range - **count** (int) - Required - The number of items in the Bin - **maxInclusive** (bool) - Optional - Should Max be included in the Range or excluded - default is excluded ``` -------------------------------- ### KurtosisNaN(IEnumerable, Func>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample Kurtosis of a sequence of nullable float values. A transform function is applied to each element to get the values. ```APIDOC ## KurtosisNaN(IEnumerable, Func>) ### Description Computes the sample Kurtosis of a sequence of nullable float values that are obtained by invoking a transform function on each element of the input sequence. ### Method GET ### Endpoint /api/statistics/kurtosisnan ### Parameters #### Query Parameters - **source** (IEnumerable) - Required - A sequence of values that are used to calculate a Kurtosis. - **selector** (Func>) - Required - A transform function to apply to each element. ### Response #### Success Response (200) - **Result** (Nullable) - The Kurtosis of the sequence of values. #### Response Example { "Result": 1.234 } ``` -------------------------------- ### Create Histogram with LinqStatistics Source: https://context7.com/dkackman/linqstatistics/llms.txt Demonstrates creating a histogram from a sequence of doubles using different binning modes. The last bin can optionally include the maximum value or the range can be expanded. ```csharp using LinqStatistics; var data = new[] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 }; // Create 5 bins IEnumerable histogram = data.Histogram(5); foreach (var bin in histogram) { Console.WriteLine($"Range [{bin.Range.Min:F1}-{bin.Range.Max:F1}): Count = {bin.Count}"); } // Output: // Range [1.0-2.8): Count = 2 // Range [2.8-4.6): Count = 2 // Range [4.6-6.4): Count = 2 // Range [6.4-8.2): Count = 2 // Range [8.2-∞): Count = 2 // With BinningMode.MaxValueInclusive (last bin includes max) var boundedHistogram = data.Histogram(5, BinningMode.MaxValueInclusive); // With BinningMode.ExpandRange (expands range beyond data) var expandedHistogram = data.Histogram(5, BinningMode.ExpandRange); // Practical example: exam score distribution var examScores = new[] { 45, 52, 58, 63, 67, 71, 74, 78, 82, 85, 88, 91, 95, 98 }; var gradeDistribution = examScores.Histogram(5, BinningMode.MaxValueInclusive); Console.WriteLine("Grade Distribution:"); foreach (var bin in gradeDistribution) { string grade = bin.Range.Min switch { >= 90 => "A", >= 80 => "B", >= 70 => "C", >= 60 => "D", _ => "F" }; Console.WriteLine($" {grade}: {bin.Count} students"); } ``` -------------------------------- ### KurtosisNaN(IEnumerable, Func>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample Kurtosis of a sequence of nullable long values. A transform function is applied to each element to get the values. ```APIDOC ## KurtosisNaN(IEnumerable, Func>) ### Description Computes the sample Kurtosis of a sequence of nullable long values that are obtained by invoking a transform function on each element of the input sequence. ### Method GET ### Endpoint /api/statistics/kurtosisnan ### Parameters #### Query Parameters - **source** (IEnumerable) - Required - A sequence of values that are used to calculate a Kurtosis. - **selector** (Func>) - Required - A transform function to apply to each element. ### Response #### Success Response (200) - **Result** (Nullable) - The Kurtosis of the sequence of values. #### Response Example { "Result": 1.234 } ``` -------------------------------- ### StandardDeviationNaN(IEnumerable>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of nullable int values. ```APIDOC ## StandardDeviationNaN(IEnumerable>) ### Description Computes the sample StandardDeviation of a sequence of nullable int values. ### Parameters #### Request Body - **source** (IEnumerable>) - Required - A sequence of nullable int values to calculate the StandardDeviation of. ### Response #### Success Response (200) - **result** (Nullable) - The StandardDeviation of the sequence of values, or null if the source sequence is empty or contains only values that are null. ``` -------------------------------- ### Calculate basic statistics with LinqStatistics Source: https://github.com/dkackman/linqstatistics/blob/master/README.md Demonstrates the usage of various statistical extension methods on an IEnumerable collection of integers. ```csharp static void Main(string[] args) { IEnumerable data = new int[] { 1, 2, 5, 6, 6, 8, 9, 9, 9 }; Console.WriteLine("Count = {0}", data.Count()); Console.WriteLine("Average = {0}", data.Average()); Console.WriteLine("Median = {0}", data.Median()); Console.WriteLine("Mode = {0}", data.Mode()); Console.WriteLine("Sample Variance = {0}", data.Variance()); Console.WriteLine("Sample Standard Deviation = {0}", data.StandardDeviation()); Console.WriteLine("Population Variance = {0}", data.VarianceP()); Console.WriteLine("Population Standard Deviation = {0}", data.StandardDeviationP()); Console.WriteLine("Range = {0}", data.Range()); } ``` -------------------------------- ### StandardDeviation (Decimal) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html Computes the sample StandardDeviation of a sequence of decimal values. ```APIDOC ## StandardDeviation(IEnumerable) ### Description Computes the sample StandardDeviation of a sequence of decimal values. ### Method GET ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **decimal**: The StandardDeviation of the sequence of values. #### Response Example N/A ``` -------------------------------- ### LeastSquares Utility and Conversion Methods Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.LeastSquares.html Methods for object conversion, formatting, and equality checks. ```APIDOC ## ToFunc(LeastSquares) ### Description Casts a LeastSquares instance to a function of the form y = mX + b. ### Parameters #### Request Body - **ls** (LeastSquares) - Required - The LeastSquares instance ### Response #### Success Response (200) - **result** (Func) - Represents the result of a LeastSquares calculation ## operator ==(LeastSquares, LeastSquares) ### Description Equality operator checking if M, B, and RSquared are equal. ### Parameters #### Request Body - **lhs** (LeastSquares) - Required - Left hand side instance - **rhs** (LeastSquares) - Required - Right hand side instance ### Response #### Success Response (200) - **result** (bool) - True if instances are equal ``` -------------------------------- ### StandardDeviationNaN(IEnumerable>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of nullable long values. ```APIDOC ## StandardDeviationNaN(IEnumerable>) ### Description Computes the sample StandardDeviation of a sequence of nullable long values. ### Parameters #### Request Body - **source** (IEnumerable>) - Required - A sequence of nullable long values to calculate the StandardDeviation of. ``` -------------------------------- ### Bin Class Properties Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.Bin.html Details of the properties available for the Bin class. ```APIDOC ## MaxInclusive ### Description Determines whether Max should be included or excluded in the range. ### Property Value - **MaxInclusive** (bool) - True if Max is included in the range, false otherwise. ``` ```APIDOC ## Range ### Description Gets the range associated with the Bin. ### Property Value - **Range** (Range) - The range of the Bin. ``` -------------------------------- ### StandardDeviationNaN(IEnumerable, Func) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of int values obtained by invoking a transform function on each element. ```APIDOC ## StandardDeviationNaN(IEnumerable, Func) ### Description Computes the sample StandardDeviation of a sequence of int values that are obtained by invoking a transform function on each element of the input sequence. ### Method GET ### Endpoint /api/stats/standarddeviationnan ### Parameters #### Query Parameters - **source** (IEnumerable) - Required - The sequence of elements. - **selector** (Func) - Required - A transform function to apply to each element. ### Response #### Success Response (200) - **StandardDeviation** (Double) - The StandardDeviation of the sequence of values. #### Response Example { "StandardDeviation": 12.34 } ``` -------------------------------- ### StandardDeviationNaN(IEnumerable) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of float values. ```APIDOC ## StandardDeviationNaN(IEnumerable) ### Description Computes the sample StandardDeviation of a sequence of float values. ### Method GET (or extension method usage) ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp var data = new float[] { 1.0f, 2.0f, 3.0f, 4.0f }; var stdDev = data.StandardDeviationNaN(); ``` ### Response #### Success Response (200) - **StandardDeviation** (Single) - The StandardDeviation of the sequence of values. #### Response Example ```json 1.29099445 ``` ``` -------------------------------- ### StandardDeviationNaN(IEnumerable>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of nullable double values. ```APIDOC ## StandardDeviationNaN(IEnumerable>) ### Description Computes the sample StandardDeviation of a sequence of nullable double values. ### Parameters #### Request Body - **source** (IEnumerable>) - Required - A sequence of nullable double values to calculate the StandardDeviation of. ### Response #### Success Response (200) - **result** (Nullable) - The StandardDeviation of the sequence of values, or null if the source sequence is empty or contains only values that are null. ``` -------------------------------- ### StandardDeviationNaN(IEnumerable) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of int values, ignoring NaN values. ```APIDOC ## StandardDeviationNaN(IEnumerable) ### Description Computes the sample StandardDeviation of a sequence of int values, ignoring NaN values. ### Method static ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **double**: The StandardDeviation of the sequence of values. #### Response Example None ``` -------------------------------- ### StandardDeviationNaN(IEnumerable, Func>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of nullable int values obtained by a transform function. ```APIDOC ## StandardDeviationNaN(IEnumerable, Func>) ### Description Computes the sample StandardDeviation of a sequence of nullable int values that are obtained by invoking a transform function on each element of the input sequence. ### Parameters - **source** (IEnumerable) - Required - The sequence of elements. - **selector** (Func>) - Required - A transform function to apply to each element. ### Returns - **double?** - The StandardDeviation of the sequence of values. ``` -------------------------------- ### StandardDeviationNaN(IEnumerable, Func>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of nullable double values obtained by invoking a transform function on each element. ```APIDOC ## StandardDeviationNaN(IEnumerable, Func>) ### Description Computes the sample StandardDeviation of a sequence of nullable double values that are obtained by invoking a transform function on each element of the input sequence. ### Method GET ### Endpoint /api/stats/standarddeviationnan ### Parameters #### Query Parameters - **source** (IEnumerable) - Required - The sequence of elements. - **selector** (Func>) - Required - A transform function to apply to each element. ### Response #### Success Response (200) - **StandardDeviation** (Nullable) - The StandardDeviation of the sequence of values. #### Response Example { "StandardDeviation": 90.12 } ``` -------------------------------- ### StandardDeviationNaN(IEnumerable, Func>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of nullable float values obtained by applying a transform function. ```APIDOC ## StandardDeviationNaN(IEnumerable, Func>) ### Description Computes the sample StandardDeviation of a sequence of nullable float values that are obtained by invoking a transform function on each element of the input sequence. ### Method GET ### Endpoint /api/stats/standarddeviationnan ### Parameters #### Query Parameters - **source** (IEnumerable) - Required - The sequence of elements. - **selector** (Func>) - Required - A transform function to apply to each element. ### Response #### Success Response (200) - **StandardDeviation** (Nullable) - The StandardDeviation of the sequence of values. #### Response Example { "StandardDeviation": 1.234 } ``` -------------------------------- ### StandardDeviationNaN(IEnumerable, Func) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of float values obtained by applying a transform function. ```APIDOC ## StandardDeviationNaN(IEnumerable, Func) ### Description Computes the sample StandardDeviation of a sequence of float values that are obtained by invoking a transform function on each element of the input sequence. ### Method GET ### Endpoint /api/stats/standarddeviationnan ### Parameters #### Query Parameters - **source** (IEnumerable) - Required - The sequence of elements. - **selector** (Func) - Required - A transform function to apply to each element. ### Response #### Success Response (200) - **StandardDeviation** (Single) - The StandardDeviation of the sequence of values. #### Response Example { "StandardDeviation": 1.234 } ``` -------------------------------- ### StandardDeviationNaN(IEnumerable>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of nullable float values. Returns null if the sequence is empty or contains only nulls. ```APIDOC ## StandardDeviationNaN(IEnumerable>) ### Description Computes the sample StandardDeviation of a sequence of nullable float values. ### Method GET (or extension method usage) ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp var data = new float?[] { 1.0f, 2.0f, null, 4.0f }; var stdDev = data.StandardDeviationNaN(); ``` ### Response #### Success Response (200) - **StandardDeviation** (Nullable) - The StandardDeviation of the sequence of values, or null if the source sequence is empty or contains only values that are null. #### Response Example ```json 4.24264059 ``` ``` -------------------------------- ### StandardDeviationPNaN(IEnumerable>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the population StandardDeviation of a sequence of nullable double values. ```APIDOC ## StandardDeviationPNaN(IEnumerable>) ### Description Computes the population StandardDeviation of a sequence of nullable double values. ### Method GET ### Endpoint /api/statistics/standarddeviationp ### Parameters #### Query Parameters - **source** (IEnumerable>) - Required - A sequence of nullable double values to calculate the population StandardDeviation of. ### Response #### Success Response (200) - **StandardDeviation** (Double?) - The population StandardDeviation of the sequence of values. ### Response Example { "StandardDeviation": 1.2345 } ``` -------------------------------- ### StandardDeviationPNaN(IEnumerable, Func>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the population StandardDeviation of a sequence of nullable float values. ```APIDOC ## StandardDeviationPNaN(IEnumerable, Func>) ### Description Computes the population StandardDeviation of a sequence of nullable float values that are obtained by invoking a transform function on each element of the input sequence. ### Method N/A (Extension Method) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Nullable** - The population StandardDeviation of the sequence of values. #### Response Example None ``` -------------------------------- ### StandardDeviationPNaN(IEnumerable) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the population StandardDeviation of a sequence of int values. ```APIDOC ## StandardDeviationPNaN(IEnumerable) ### Description Computes the population StandardDeviation of a sequence of int values. ### Method GET ### Endpoint /api/statistics/standarddeviationp ### Parameters #### Query Parameters - **source** (IEnumerable) - Required - A sequence of int values to calculate the population StandardDeviation of. ### Response #### Success Response (200) - **StandardDeviation** (Double) - The population StandardDeviation of the sequence of values. ### Response Example { "StandardDeviation": 1.2345 } ``` -------------------------------- ### ItemCount Class Overview Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.ItemCount-1.html Provides details about the ItemCount class, its constructors, properties, methods, and operators. ```APIDOC ## Class ItemCount Namespace [LinqStatistics](LinqStatistics.html) Assembly LinqStatistics.dll Represents the count of an item in a collection public class ItemCount : IEquatable> #### Type Parameters `T` The type of the item Inheritance [object](https://learn.microsoft.com/dotnet/api/system.object) ItemCount Implements [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)<[ItemCount](LinqStatistics.ItemCount-1.html)> Derived [Bin](LinqStatistics.Bin.html) ### Constructors #### ItemCount(T, int) Represents the count of an item in a collection public ItemCount(T v, int count) #### Parameters `v` T `count` [int](https://learn.microsoft.com/dotnet/api/system.int32) ### Properties #### Count The number of times RepresentativeValue appears in the source data public int Count { get; } #### Property Value [int](https://learn.microsoft.com/dotnet/api/system.int32) Represents the count of an item in a collection #### RepresentativeValue The value represented by the bin public T RepresentativeValue { get; } #### Property Value T Represents the count of an item in a collection ### Methods #### Equals(ItemCount) [Equals(T)](https://learn.microsoft.com/dotnet/api/system.iequatable-1.equals) public bool Equals(ItemCount other) #### Parameters `other` [ItemCount](LinqStatistics.ItemCount-1.html) #### Returns [bool](https://learn.microsoft.com/dotnet/api/system.boolean) #### Equals(object) [Equals(object)](LinqStatistics.ItemCount-1.html#LinqStatistics_ItemCount_1_Equals_System_Object_) public override bool Equals(object obj) #### Parameters `obj` [object](https://learn.microsoft.com/dotnet/api/system.object) The item to compare to. #### Returns [bool](https://learn.microsoft.com/dotnet/api/system.boolean) True if obj is a Bin{T} and Value and Count are equal #### GetHashCode() [GetHashCode()](LinqStatistics.ItemCount-1.html#LinqStatistics_ItemCount_1_GetHashCode) public override int GetHashCode() #### Returns [int](https://learn.microsoft.com/dotnet/api/system.int32) Hash of Value and Count #### ToString() [ToString()](LinqStatistics.ItemCount-1.html#LinqStatistics_ItemCount_1_ToString) public override string ToString() #### Returns [string](https://learn.microsoft.com/dotnet/api/system.string) ### Operators #### operator ==(ItemCount, ItemCount) public static bool operator ==(ItemCount lhs, ItemCount rhs) #### Parameters `lhs` [ItemCount](LinqStatistics.ItemCount-1.html) `rhs` [ItemCount](LinqStatistics.ItemCount-1.html) #### Returns [bool](https://learn.microsoft.com/dotnet/api/system.boolean) #### operator !=(ItemCount, ItemCount) public static bool operator !=(ItemCount lhs, ItemCount rhs) ``` -------------------------------- ### StandardDeviationNaN(IEnumerable, Func) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of double values obtained by a transform function. ```APIDOC ## StandardDeviationNaN(IEnumerable, Func) ### Description Computes the sample StandardDeviation of a sequence of double values that are obtained by invoking a transform function on each element of the input sequence. ### Method GET (or extension method usage) ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp var data = new[] { "1.0", "2.0", "3.0", "4.0" }; var stdDev = data.StandardDeviationNaN(x => double.Parse(x)); ``` ### Response #### Success Response (200) - **StandardDeviation** (Double) - The StandardDeviation of the sequence of values. #### Response Example ```json 1.29099445 ``` ``` -------------------------------- ### RootMeanSquare Methods Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html A collection of RootMeanSquare extension methods for different numeric types. ```APIDOC ## RootMeanSquare(IEnumerable, Func) ### Description Computes the RootMeanSquare of a sequence of decimal values obtained by invoking a transform function on each element. ### Parameters - **source** (IEnumerable) - Required - A sequence of values to calculate the RootMeanSquare of. - **selector** (Func) - Required - A transform function to apply to each element. ### Returns - **decimal** - The RootMeanSquare. --- ## RootMeanSquare(IEnumerable, Func) ### Description Computes the RootMeanSquare of a sequence of double values obtained by invoking a transform function on each element. ### Parameters - **source** (IEnumerable) - Required - A sequence of values to calculate the RootMeanSquare of. - **selector** (Func) - Required - A transform function to apply to each element. ### Returns - **double** - The RootMeanSquare. --- ## RootMeanSquare(IEnumerable, Func) ### Description Computes the RootMeanSquare of a sequence of int values obtained by invoking a transform function on each element. ### Parameters - **source** (IEnumerable) - Required - A sequence of values to calculate the RootMeanSquare of. - **selector** (Func) - Required - A transform function to apply to each element. ### Returns - **double** - The RootMeanSquare. --- ## RootMeanSquare(IEnumerable, Func) ### Description Computes the RootMeanSquare of a sequence of long values obtained by invoking a transform function on each element. ### Parameters - **source** (IEnumerable) - Required - A sequence of values to calculate the RootMeanSquare of. - **selector** (Func) - Required - A transform function to apply to each element. ### Returns - **double** - The RootMeanSquare. --- ## RootMeanSquare(IEnumerable, Func) ### Description Computes the RootMeanSquare of a sequence of nullable decimal values obtained by invoking a transform function on each element. ### Parameters - **source** (IEnumerable) - Required - A sequence of values to calculate the RootMeanSquare of. - **selector** (Func) - Required - A transform function to apply to each element. ### Returns - **decimal?** - The RootMeanSquare. ``` -------------------------------- ### StandardDeviation (Double) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html Computes the sample StandardDeviation of a sequence of double values. ```APIDOC ## StandardDeviation(IEnumerable) ### Description Computes the sample StandardDeviation of a sequence of double values. ### Method GET ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **double**: The StandardDeviation of the sequence of values. #### Response Example N/A ``` -------------------------------- ### StandardDeviation(IEnumerable, Func) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html Computes the sample StandardDeviation of a sequence of float values obtained by a transform function. ```APIDOC ## StandardDeviation(IEnumerable, Func) ### Description Computes the sample StandardDeviation of a sequence of float values that are obtained by invoking a transform function on each element of the input sequence. ### Method `public static float StandardDeviationNaN(this IEnumerable source, Func selector)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - `source` (IEnumerable) - The sequence of elements. - `selector` (Func) - A transform function to apply to each element. ### Returns - `float?` - The StandardDeviation of the sequence of values. ### Type Parameters - `TSource` - The type of the elements of source. ``` -------------------------------- ### StandardDeviationP(IEnumerable) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html Computes the population StandardDeviation of a sequence of int values. ```APIDOC ## StandardDeviationP(IEnumerable) ### Description Computes the population StandardDeviation of a sequence of int values. ### Method `public static double StandardDeviationP(this IEnumerable source)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - `source` (IEnumerable) - A sequence of int values to calculate the population StandardDeviation of. ### Returns - `double` - The population StandardDeviation of the sequence of values. ### Remarks ![equation](../images/stdevp.gif) ``` -------------------------------- ### StandardDeviationP(IEnumerable) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html Computes the population StandardDeviation of a sequence of decimal values. ```APIDOC ## StandardDeviationP(IEnumerable) ### Description Computes the population StandardDeviation of a sequence of decimal values. ### Method `public static decimal StandardDeviationP(this IEnumerable source)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - `source` (IEnumerable) - A sequence of decimal values to calculate the population StandardDeviation of. ### Returns - `decimal` - The population StandardDeviation of the sequence of values. ### Remarks ![equation](../images/stdevp.gif) ``` -------------------------------- ### StandardDeviationPNaN(IEnumerable, Func) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the population StandardDeviation of a sequence of nullable int values obtained by a transform function. ```APIDOC ## StandardDeviationPNaN(IEnumerable, Func) ### Description Computes the population StandardDeviation of a sequence of nullable int values that are obtained by invoking a transform function on each element of the input sequence. ### Parameters - **source** (IEnumerable) - Required - The sequence of elements. - **selector** (Func) - Required - A transform function to apply to each element. ### Returns - **double?** - The population StandardDeviation of the sequence of values. ``` -------------------------------- ### VarianceNaN Extension Methods Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html A collection of extension methods for computing sample variance on sequences of integers, longs, floats, and their nullable counterparts. ```APIDOC ## VarianceNaN(IEnumerable) ### Description Computes the sample Variance of a sequence of numeric values. ### Parameters #### Request Body - **source** (IEnumerable) - Required - A sequence of numeric values (int, long, float, or nullable variants) to calculate the Variance of. ### Response #### Success Response (200) - **result** (double/float) - The Variance of the sequence of values, or null if the source sequence is empty or contains only null values (for nullable types). ``` -------------------------------- ### ToString() Method Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.Bin.html Overrides the default ToString method for the Bin class. ```APIDOC ## ToString() ### Description Overrides the default ToString method to provide a string representation of the Bin object. ### Method `public override string ToString()` ### Returns - `string` - A string representation of the Bin object. ``` -------------------------------- ### LinqStatistics API Overview Source: https://github.com/dkackman/linqstatistics/blob/master/docfx/api/index.md Overview of the statistical methods available in the LinqStatistics API. ```APIDOC ## LinqStatistics API The LinqStatistics API provides extension methods for various statistical calculations, modelled after `System.Linq.Enumerable`. It supports intrinsic numeric types and includes implementations that handle potential exceptions like divide by zero by returning `NaN`. ### Statistics Included - **CountEach**: Counts the occurrences of each distinct element in a collection. - **Covariance**: Calculates the covariance between two collections of decimal numbers. - **Histogram**: Generates a histogram for a collection of decimal numbers with specified binning. - **Kurtosis**: Computes the kurtosis of a collection of decimal numbers. - **Least Squares Linear Regression**: Performs least squares linear regression on a collection of tuples representing (x, y) coordinates. - **Median**: Calculates the median of a collection of decimal numbers. - **MinMax**: Finds the minimum and maximum values in a collection of decimal numbers. - **Mode**: Determines the mode (most frequent value) of a collection. - **Pearson**: Computes the Pearson correlation coefficient between two collections of decimal numbers. - **Range**: Calculates the range (difference between maximum and minimum) of a collection of decimal numbers. - **Root Mean Square**: Computes the root mean square of a collection of decimal numbers. - **Skewness**: Calculates the skewness of a collection of decimal numbers. - **Standard Deviation**: Computes the sample and population standard deviation for a collection of decimal numbers. - **Variance**: Computes the sample and population variance for a collection of decimal numbers. ``` -------------------------------- ### StandardDeviationNaN(IEnumerable) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of long values, ignoring NaN values. ```APIDOC ## StandardDeviationNaN(IEnumerable) ### Description Computes the sample StandardDeviation of a sequence of long values, ignoring NaN values. ### Method static ### Endpoint N/A (Extension Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **double**: The StandardDeviation of the sequence of values. #### Response Example None ``` -------------------------------- ### StandardDeviationPNaN(IEnumerable, Func) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the population StandardDeviation of a sequence of float values. ```APIDOC ## StandardDeviationPNaN(IEnumerable, Func) ### Description Computes the population StandardDeviation of a sequence of float values that are obtained by invoking a transform function on each element of the input sequence. ### Method N/A (Extension Method) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Single** - The population StandardDeviation of the sequence of values. #### Response Example None ``` -------------------------------- ### StandardDeviation Methods Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html Methods for computing the sample Standard Deviation of sequences of float or nullable float values. ```APIDOC ## StandardDeviation(IEnumerable, Func) ### Description Computes the sample StandardDeviation of a sequence of nullable float values that are obtained by invoking a transform function on each element of the input sequence. ### Parameters #### Request Body - **source** (IEnumerable) - Required - The sequence of elements. - **selector** (Func) - Required - A transform function to apply to each element. ### Response #### Success Response (200) - **return** (float?) - The StandardDeviation of the sequence of values. --- ## StandardDeviation(IEnumerable, Func) ### Description Computes the sample StandardDeviation of a sequence of float values that are obtained by invoking a transform function on each element of the input sequence. ### Parameters #### Request Body - **source** (IEnumerable) - Required - The sequence of elements. - **selector** (Func) - Required - A transform function to apply to each element. ### Response #### Success Response (200) - **return** (float) - The StandardDeviation of the sequence of values. ``` -------------------------------- ### StandardDeviationNaN(IEnumerable, Func>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of nullable long values obtained by a transform function. ```APIDOC ## StandardDeviationNaN(IEnumerable, Func>) ### Description Computes the sample StandardDeviation of a sequence of nullable long values that are obtained by invoking a transform function on each element of the input sequence. ### Parameters - **source** (IEnumerable) - Required - The sequence of elements. - **selector** (Func>) - Required - A transform function to apply to each element. ### Returns - **double?** - The StandardDeviation of the sequence of values. ``` -------------------------------- ### StandardDeviationPNaN(IEnumerable, Func>) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the population StandardDeviation of a sequence of nullable double values obtained by applying a transform function. ```APIDOC ## StandardDeviationPNaN(IEnumerable, Func>) ### Description Computes the population StandardDeviation of a sequence of nullable double values that are obtained by invoking a transform function on each element of the input sequence. ### Method Static method ### Endpoint N/A (Extension method for IEnumerable) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp var data = new[] { 1.0, 2.0, null, 4.0, 5.0 }; var stdDev = data.StandardDeviationPNaN(x => x); ``` ### Response #### Success Response (200) - **Nullable** - The population StandardDeviation of the sequence of values. #### Response Example ```json { "example": "2.23606797749979" } ``` ``` -------------------------------- ### StandardDeviationNaN(IEnumerable, Func) Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.NaN.EnumerableStats.html Computes the sample StandardDeviation of a sequence of long values obtained by invoking a transform function on each element. ```APIDOC ## StandardDeviationNaN(IEnumerable, Func) ### Description Computes the sample StandardDeviation of a sequence of long values that are obtained by invoking a transform function on each element of the input sequence. ### Method GET ### Endpoint /api/stats/standarddeviationnan ### Parameters #### Query Parameters - **source** (IEnumerable) - Required - The sequence of elements. - **selector** (Func) - Required - A transform function to apply to each element. ### Response #### Success Response (200) - **StandardDeviation** (Double) - The StandardDeviation of the sequence of values. #### Response Example { "StandardDeviation": 56.78 } ``` -------------------------------- ### StandardDeviationPNaN Methods Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html Extension methods to compute the population standard deviation of a sequence of numeric values. ```APIDOC ## StandardDeviationPNaN ### Description Computes the population standard deviation of a sequence of numeric values (float, double, int, long, or their nullable counterparts). ### Parameters #### Request Body - **source** (IEnumerable) - Required - A sequence of numeric values to calculate the population StandardDeviation of. ### Response #### Success Response (200) - **result** (double or double?) - The population StandardDeviation of the sequence of values, or null if the source sequence is empty or contains only null values. ``` -------------------------------- ### StandardDeviation Methods Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html Methods for calculating the sample standard deviation of sequences of float values. ```APIDOC ## StandardDeviation(IEnumerable) ### Description Computes the sample StandardDeviation of a sequence of nullable float values. ### Parameters - **source** (IEnumerable) - Required - A sequence of nullable float values to calculate the StandardDeviation of. ### Returns - **float?** - The StandardDeviation of the sequence of values, or null if the source sequence is empty or contains only values that are null. ## StandardDeviation(IEnumerable) ### Description Computes the sample StandardDeviation of a sequence of float values. ### Parameters - **source** (IEnumerable) - Required - A sequence of float values to calculate the StandardDeviation of. ### Returns - **float** - The StandardDeviation of the sequence of values. ``` -------------------------------- ### Sum Methods Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html Methods for computing the sum of sequences of BigInteger values. ```APIDOC ## Sum(IEnumerable) ### Description Computes the Sum of a sequence of nullable BigInteger values. ### Parameters #### Request Body - **source** (IEnumerable) - Required - A sequence of nullable BigInteger values to calculate the Sum of. ### Response #### Success Response (200) - **return** (BigInteger?) - The Sum of the sequence of values, or null if the source sequence is empty or contains only values that are null. --- ## Sum(IEnumerable) ### Description Computes the Sum of a sequence of BigInteger values. ### Parameters #### Request Body - **source** (IEnumerable) - Required - A sequence of BigInteger values to calculate the Sum of. ### Response #### Success Response (200) - **return** (BigInteger) - The Sum of the sequence of values. --- ## SumNaN(IEnumerable, Func) ### Description Computes the Sum of a sequence of nullable BigInteger values that are obtained by invoking a transform function on each element of the input sequence. ### Parameters #### Request Body - **source** (IEnumerable) - Required - The sequence of elements. - **selector** (Func) - Required - A transform function to apply to each element. ### Response #### Success Response (200) - **return** (BigInteger?) - The Sum of the sequence of values. ``` -------------------------------- ### SkewnessNaN Methods Source: https://github.com/dkackman/linqstatistics/blob/master/docs/api/LinqStatistics.EnumerableStats.html A collection of extension methods for calculating sample skewness on sequences of numeric values. ```APIDOC ## SkewnessNaN(IEnumerable, Func) ### Description Computes the sample Skewness of a sequence of long values that are obtained by invoking a transform function on each element of the input sequence. ### Parameters #### Type Parameters - **TSource** - The type of the elements of source. #### Parameters - **source** (IEnumerable) - Required - A sequence of values that are used to calculate a Skewness - **selector** (Func) - Required - A transform function to apply to each element. ### Response - **Returns** (double) - The Skewness of the sequence of values. --- ## SkewnessNaN(IEnumerable, Func) ### Description Computes the sample Skewness of a sequence of nullable double values that are obtained by invoking a transform function on each element of the input sequence. ### Parameters #### Type Parameters - **TSource** - The type of the elements of source. #### Parameters - **source** (IEnumerable) - Required - A sequence of values that are used to calculate a Skewness - **selector** (Func) - Required - A transform function to apply to each element. ### Response - **Returns** (double?) - The Skewness of the sequence of values. --- ## SkewnessNaN(IEnumerable, Func) ### Description Computes the sample Skewness of a sequence of nullable int values that are obtained by invoking a transform function on each element of the input sequence. ### Parameters #### Type Parameters - **TSource** - The type of the elements of source. #### Parameters - **source** (IEnumerable) - Required - A sequence of values that are used to calculate a Skewness - **selector** (Func) - Required - A transform function to apply to each element. ### Response - **Returns** (double?) - The Skewness of the sequence of values. --- ## SkewnessNaN(IEnumerable, Func) ### Description Computes the sample Skewness of a sequence of nullable long values that are obtained by invoking a transform function on each element of the input sequence. ### Parameters #### Type Parameters - **TSource** - The type of the elements of source. #### Parameters - **source** (IEnumerable) - Required - A sequence of values that are used to calculate a Skewness - **selector** (Func) - Required - A transform function to apply to each element. ### Response - **Returns** (double?) - The Skewness of the sequence of values. ```