关于如何使用Math.NET计算t分布中的临界值,有什么想法吗?
更具体地说,我正在寻找如何使用Math.NET计算以下excel函数。
=T.INV.2T(0.05, 8)发布于 2019-12-25 23:21:34
怎么样
var x = MathNet.Numerics.Distributions.StudentT.InvCDF(location:0.0, scale:1.0, freedom: (double)8, p: 0.05);应该检查T.INV.2T是否返回双尾值,如果不是只调整概率
您还可以将here与临界值进行比较
更新
C#代码如下(.NET Core3.1、Math.NET v4.9、Win10 x64)
using System;
using MathNet.Numerics.Distributions;
namespace Tinv
{
class Program
{
public static double T_INV_2T(double p, double nu)
{
return StudentT.InvCDF(location:0.0, scale:1.0, freedom: nu, p: 1.0 - p/2.0);
// same as return Math.Abs(StudentT.InvCDF(location:0.0, scale:1.0, freedom: nu, p: p/2.0));
}
static void Main(string[] args)
{
var x = T_INV_2T(0.05, (double)8);
Console.WriteLine($"Output = {x}");
}
}
}产生的输出
2.306004135204172其中,Excel生成的=T.INV.2T(0.05, 8)值等于2.306004,而在NIST表中,链接值列为2.306
看起来相当一致
https://stackoverflow.com/questions/59473824
复制相似问题