跳到主要内容

NEGBINOM_DIST

返回负二项分布,即在最后一次成功之前有指定次数失败的概率,以及指定的成功概率。

语法

expression.NEGBINOM_DIST(arg1, arg2, arg3, arg4);

expression - 表示 ApiWorksheetFunction 类的变量。

参数

名称必需/可选数据类型默认值描述
arg1必需ApiRange | ApiName | number失败次数。
arg2必需ApiRange | ApiName | number成功次数阈值。
arg3必需ApiRange | ApiName | number成功的概率;一个介于 0 和 1 之间的数字。
arg4必需ApiRange | ApiName | boolean决定函数形式的逻辑值(truefalse)。如果为 true,则函数返回累积分布函数。如果为 false,则函数返回概率密度函数。

返回值

number

示例

此示例演示如何返回负二项分布,即在最后一次成功之前出现指定失败次数的概率,成功概率为指定值。

// How to return the negative binomial distribution.

// Use a function to get the probability of the specified number of failures before the last success (negative binomial distribution).

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.NEGBINOM_DIST(6, 32, 0.7, true));