2026a

# nsegments


广义帕累托分布中的段数

函数库: TyStatistics

# 语法

n = nsegments(pd)

# 说明

n = nsegments(pd) 返回广义帕累托分布对象 pd 中的段数。 示例

# 示例

paretotails 对象中的段数

生成样本数据集并使用 paretotails 将具有 Pareto 尾部的分段分布拟合到数据。 使用对象函数 nsegments 查找拟合分布中的段数。

生成右尾包含 10% 离群值的样本数据集。

using TyMath
using TyStatistics
rng = MT19937ar(5489)
right_tail = exprnd(rng,5,100,1)
center = randn(rng,900,1)
x = [center;right_tail]

通过将广义帕累托分布拟合到 x 创建一个 paretotails 对象。 使用下尾部和上部尾部累积概率指定尾部的边界。 传入 0 和 0.9,使拟合对象不包含下尾段,并由数据集下部 90% 的经验分布和数据集上部 10% 的广义帕累托分布 (GPD) 组成。

pd = paretotails(x,0,0.9)

具有 2 个段的分段分布
   -Inf < x < 1.73931  (0 < p < 0.9): interpolated empirical cdf
    1.73931 < x < Inf  (0.9 < p < 1): 上尾,GPD(0.643752,1.62246)

使用 nsegments 函数返回 pd 中的段数。

n = nsegments(pd)
n = 2

# 输入参数

pd - 具有 Pareto 尾部的分段分布
Paretotails 对象

具有 Pareto 尾部的分段分布,指定为 paretotails 对象。

# 另请参阅

paretotails | boundary | segment | upperparams | lowerparams