0

有没有一种方法可以从 StudentT 类中获取 ttest-value 和 P-Value。我正在尝试从该库中计算这些值:https ://numerics.mathdotnet.com/api/MathNet.Numerics.Distributions/StudentT.htm

excel的等效函数是T-Test。但我在 math.net numerics excel 函数中没有这种方法。下面的链接显示了所有的 excel 方法: https ://numerics.mathdotnet.com/api/MathNet.Numerics/ExcelFunctions.htm

从上述库中完成此操作的任何指针都会有很大帮助。

谢谢...

4

2 回答 2

1

我不知道如何在 Math.Net 中执行此操作,但我知道如何在 Meta.Numerics 中执行此操作:

        Sample sample1 = new Sample(1.0, 2.0, 3.0, 4.0);
        Sample sample2 = new Sample(3.0, 4.0, 5.0, 6.0);
        TestResult tTest = Sample.StudentTTest(sample1, sample2);
        Console.WriteLine("t = {0}", tTest.Statistic);
        Console.WriteLine("P = {0} ({1})", tTest.Probability, tTest.Type);

我了解您是否对更改数学库不感兴趣,但是由于您的问题已经过了一段时间没有答案,我想我会插话的。

于 2017-05-16T20:48:37.303 回答
0

以下是如何使用 MathNet.Numerics 库集执行左尾 t 检验。

假设您在数组中有一些数据,并且您已经计算了所有必需的初步统计数据,如下所示。

    int n = 5;    //size of sample
    double hypotheziedMean = 50.0;   
    double sampleMean = 50.03;
    double sampleSD = 1.5;    //sample standard deviation (n-1)

    double stdErr = sampleSD / Math.Sqrt(n);    //standard error of the mean
    double t = (sampleMean - hypotheziedMean) / stdErr;   //convert to a standard mean of 0 and SD of 1

    StudentT st = new StudentT(0, 1, n-1); //create a standard StudentT object with n-1 DOF

    double pVal = st.CumulativeDistribution(t);  //left tail pval
于 2021-06-23T06:41:10.373 回答