目前,我已经在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作为变量。我不认为Excel中存在一个 - 这会是一个很好的方法吗?
答案 0 :(得分:0)
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