学生的T分布在Excel VBA中?

目前我已经在Excel VBA中编写了一个函数,它基本上使用一个数据表来计算一个Z值。 然后,我通过使用excel函数NormSDist从这个Z分数得到一个概率值。 代码的最后几行看起来像这样:

... Dim disToDef As Double: disToDef = (Log(asset(iNumRows) / debt(iNumRows)) + (meanAsset - sigmaAsset ^ 2 / 2) * maturity) / (sigmaAsset * Sqr(maturity)) Dim defProb As Double: defProb = WorksheetFunction.NormSDist(-disToDef) KMVModel = defProb End Function 

我想要得到一个相当于T分布的NormSDist(z)的函数,我可以把z作为一个variables。 我不认为在Excel中存在 – 这是一个很好的方法来处理这个问题?

Excel可以处理T分发:

 Sub test() Debug.Print Application.WorksheetFunction.T_Dist(0.95, 20, False) 'pdf value Debug.Print Application.WorksheetFunction.T_Dist(0.95, 20, True) 'cdf value End Sub 

输出:

 0.247866113626846 0.823274027108808