Matlab 使用百分位点定义分布
在@Risk和Crystal Ball中,我们可以使用百分位数据定义概率分布。例如,我们可以通过输入3个数据点定义对数正态分布,例如P10、P50和P90估计值。然后,软件将推出发行版的PDF。这实际上是如何做到的?以Matlab、Excel或Mathematica为例即可Matlab 使用百分位点定义分布,matlab,statistics,wolfram-mathematica,probability,Matlab,Statistics,Wolfram Mathematica,Probability,在@Risk和Crystal Ball中,我们可以使用百分位数据定义概率分布。例如,我们可以通过输入3个数据点定义对数正态分布,例如P10、P50和P90估计值。然后,软件将推出发行版的PDF。这实际上是如何做到的?以Matlab、Excel或Mathematica为例即可 在文档中,没有明确说明软件是如何实现的 从对数正态分布开始计算第10、50和90个百分位,该对数正态分布源自平均值为1、标准偏差为0.5的正态分布 μ = 1; σ = 0.5; p[n_] := Quantile[Log
在文档中,没有明确说明软件是如何实现的 从对数正态分布开始计算第10、50和90个百分位,该对数正态分布源自平均值为1、标准偏差为0.5的正态分布
μ = 1;
σ = 0.5;
p[n_] := Quantile[LogNormalDistribution[μ, σ], n]
p10 = p[0.1]
1.43222
2.71828
5.15917
现在,按照OP的问题要求,仅从百分位数开始计算μ
和σ
Clear[μ, σ]
sol = Quiet@First@Solve[{
Quantile[LogNormalDistribution[μ, σ], 0.1] == p10,
Quantile[LogNormalDistribution[μ, σ], 0.5] == p50,
Quantile[LogNormalDistribution[μ, σ], 0.9] == p90}, {μ, σ}]
{μ->1.,σ->0.5}
对数正态均值和方差:
Mean[LogNormalDistribution[μ, σ]] /. sol
3.08022
2.69476
检查符号计算和定义以理解计算
谢谢,使用Mathematics很容易实现。如果有人能在使用Matlab时提供工作流,请欣赏。我们可以按照下面的Mathematica解进行反向计算吗?
Show[
Plot[PDF[LogNormalDistribution[μ, σ], x], {x, 0, 12}],
Plot[PDF[LogNormalDistribution[μ, σ], x], {x, 0, #},
PlotStyle -> None, Filling -> Axis] & /@ {p10, p50, p90},
Epilog -> MapThread[Inset[#1, {#2, 0.025}] &,
{{"p10", "p50", "p90"}, {p10, p50, p90}}]]
Clear[μ, σ]
sol = Quiet@First@Solve[{
Quantile[LogNormalDistribution[μ, σ], 0.1] == p10,
Quantile[LogNormalDistribution[μ, σ], 0.5] == p50,
Quantile[LogNormalDistribution[μ, σ], 0.9] == p90}, {μ, σ}]
Mean[LogNormalDistribution[μ, σ]] /. sol
Variance[LogNormalDistribution[μ, σ]] /. sol