WorksheetFunction.Quartile equivalent in c#

We are currently doing a MS-Access to .Net web page project. In MS-Access VBA code they have used WorksheetFunction.Quartile function. Please let me know the equivalent function in C#.

Sample usage in VBA:

Q1 = WorksheetFunction.Quartile(arrY, 1)

View More Answer And Comment : Stackoverflow


Top Answer 1

I dont know of any wrapped up nice little function like that, though would be very helpful. I recommend installing math.NET
http://www.mathdotnet.com/

Here shows all that is included in SortedArrayStatistics
http://numerics.mathdotnet.com/api/MathNet.Numerics.Statistics/SortedArrayStatistics.htm

below is a quartile example that I believe meets your needs

using System;
using MathNet.Numerics.Statistics;
class Test
{
    static void Main()
    {
        double numbers = new double { 1, 2, 3, 4, 5 };
        double a = SortedArrayStatistics.Minimum(numbers);
        double b = SortedArrayStatistics.LowerQuartile(numbers);
        double c = SortedArrayStatistics.Median(numbers);
        double d = SortedArrayStatistics.UpperQuartile(numbers);
        double e = SortedArrayStatistics.Maximum(numbers);

        Console.WriteLine({0}\n{1}\n{2}\n{3}\n{4}\n, a,b,c,d,e);
    }
}

output

1
1.66666666666667
3
4.33333333333333
5

Top Answer 2

I dont know of any wrapped up nice little function like that, though would be very helpful. I recommend installing math.NET
http://www.mathdotnet.com/

Here shows all that is included in SortedArrayStatistics
http://numerics.mathdotnet.com/api/MathNet.Numerics.Statistics/SortedArrayStatistics.htm

below is a quartile example that I believe meets your needs

using System;
using MathNet.Numerics.Statistics;
class Test
{
    static void Main()
    {
        double numbers = new double { 1, 2, 3, 4, 5 };
        double a = SortedArrayStatistics.Minimum(numbers);
        double b = SortedArrayStatistics.LowerQuartile(numbers);
        double c = SortedArrayStatistics.Median(numbers);
        double d = SortedArrayStatistics.UpperQuartile(numbers);
        double e = SortedArrayStatistics.Maximum(numbers);

        Console.WriteLine({0}\n{1}\n{2}\n{3}\n{4}\n, a,b,c,d,e);
    }
}

output

1
1.66666666666667
3
4.33333333333333
5

View More Answer And Comment : Stackoverflow

# TODO in rails

I had read through a rails book and once found we can add # TODO: and some # stuff in codes, so we can you some rake cmd to look back. My problems is I can't find where are those "# stuff" and "rake [Read More...]

Date Formats in MVC

My view models and controllers seem to save the date time in a different format. For instance, in my view in the HTML text box, if I had entered in 07/12/2015, it would have saved the value as if it [Read More...]

JQuery hover out two div

I have two HTML table row, When I hover first tr I want to show this and second tr and when mouse will be out of both tr second tr must be a hide. How Can I do this using JQuery? <tr [Read More...]

Validating email in paypal account

Please suggest how to validate an email account for paypal, whether a transaction account in paypal is exists or not before transaction. In adaptive payment , we can pay through payapl email ids.. [Read More...]

Creating a looped desktop screen

I would like to create a program that "loops" my desktop. What I mean by that: when my mouse or a window touches the right side of the screen, it doesn't stop there, but moves to the left side of the [Read More...]

Read N lines at a time using BASH

I googled a lot; and can find many posts regarding read N lines at a time using python. While for BASH, I can hardly find any posts. (There are posts about using bash to read ONE line at a time, or [Read More...]

Program Guidance DO WHILE loop

I need some structural help! I know how to get what I need done but I can't decipher how to do it via a loop. So I have a database of IDs in a text file. They are separated by lines for ease of [Read More...]

Should we use exit() in C?

There is question about using exit in C++. The answer discusses that it is not good idea mainly because of RAII, e.g., if exit is called somewhere in code, destructors of objects will not be called, [Read More...]

plupload cant upload large files

I am trying to upload the pdf file whose size is over 8MB. I made the following configuration setting for my php file, but no progress made at all :(. Any help would be appreciated. a. [Read More...]

Perl GD module wont install

I'm trying to figure out why I can't get the GD perl module to install on my Debian 7 server. Here is how I installed the core stuff: sudo apt-get install libgd-gd2-perl Then running the -MCPAN to [Read More...]