20

Does anybody know of any good and free statistics libraries for .Net?

I am working on calculating T-Tests, which I have written a formula to calculate, although now I need a formula for the p-value, which is a little more complex, and not being a statistician, has me a little lost.

MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
Darren Young
  • 10,972
  • 36
  • 91
  • 150
  • 1
    flagged as duplicate: http://stackoverflow.com/questions/139384/recommend-an-open-source-net-statistics-library – goric Mar 09 '11 at 13:40
  • 4
    This is not duplicate. I have requested a library with SPECIFIC functionality that is not mentioned in that post. – Darren Young Mar 09 '11 at 13:48
  • I agree now that the title is clearly asking for specific functionality and the question is re-worded. – goric Mar 09 '11 at 20:14
  • IMSL .Net http://www.roguewave.com/products/imsl-numerical-libraries/.net-library.aspx. You can start by looking at their online documentation. –  Sep 27 '12 at 16:06

6 Answers6

8

I suggest you look at the Math.NET project. It supports various distributions, but I don't know if it has t-tests and p-values.

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
John Alexiou
  • 28,472
  • 11
  • 77
  • 133
  • 6
    Math.Net has a StudentT class under MathNet.Numerics.Distributions, which exposes a CumulativeDistribution function. The two-tailed p value associated with a given t is 2 * (1 - CumulativeDistribution(t)). (see http://en.wikipedia.org/wiki/Student's_t-distribution#Table_of_selected_values) – etov Nov 24 '13 at 10:13
  • @etov What would the C# code look like? – DarthVegan Sep 06 '17 at 02:00
  • 2
    @user3610374 - something like: 2 * (1 - StudentT.CDF(0,1,samples.Length-1,t)) (untested) – etov Sep 06 '17 at 07:49
  • @etov Another question is which method/where in the documentation does it show how to calculate the t statistic? – DarthVegan Sep 06 '17 at 15:00
  • Try Googling "how to calculate the t statistic"? "Subtract the population mean from the sample mean: x-bar - μ. Divide s by the square root of n, the number of units in the sample: s/sqrt(n)." – etov Sep 07 '17 at 07:18
3

Since version 4 the .NET libraries include the StatisticFormula class which provides T-Tests. This class is available in the namespaces System.Web.UI.DataVisualization.Charting and System.Windows.Forms.DataVisualization.Charting

Link to documentation and usage:

TTestResult result = Chart1.DataManipulator.Statistics.TTestUnEqualVariances(0.2, 0.05, "Series1", "Series2");
Neil
  • 3,899
  • 1
  • 29
  • 25
3

Meta.Numerics has a lot of statistical functionality. It supports t-tests (one sample, two sample, paired), as well as Mann-Whitney and sign tests (non-parameteric alternatives to t-tests), and ANOVA (a t-test extended to more than two samples) and Kruskal-Wallis (a non-parameteric alternative to the ANOVA). And yes, it reports back a P-value with all tests.

David Wright
  • 765
  • 6
  • 15
0

Use the accord framework:

Accord Framework

dashnick
  • 2,020
  • 19
  • 34
0

NAverage is one such dll i have used in the past.

You can check it ...

http://www.mycsharp.de/wbb2/thread.php?threadid=85839

or from here ..

http://naverage.codeplex.com/

Let me know if that helps

this-Me
  • 2,139
  • 6
  • 43
  • 70
0

you might be interested in infer.net http://www.justinlee.sg/2009/12/09/infer-net-now-with-f-support/

"Infer.NET is a framework for running Bayesian inference in graphical models. You can use it to solve many different kinds of machine learning problems, from standard problems like classification or clustering through to customised solutions to domain-specific problems. Infer.NET has been used in a wide variety of domains including information retrieval, bioinformatics, epidemiology, vision, and many others."

GreyCloud
  • 3,030
  • 5
  • 32
  • 47