问题标签 [gamma-distribution]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
65 浏览

gamma-distribution - invgamma包的密度函数错了吗?

它似乎给出了一个与维基百科和其他包invgamma::dinvgamma都不同的值。

实际上,应该调用scalein 参数。invgamma:dinvgammarate

0 投票
2 回答
6756 浏览

r - 在 R 中绘制伽马分布

我正在尝试使用 R 绘制伽马分布直方图

所以我有

我之前计算的平均值为

所以我应该用 100 个观测值绘制直方图scale = 10 and shape = 0.5

所以我试过了

我明白了

在此处输入图像描述

这是错误的,因为平均值应该是 5,但我的情节没有产生 5

我哪里错了?

0 投票
1 回答
1172 浏览

r - R中的经验贝叶斯

David Robinson 给出了一个使用 beta 分布更新经验贝叶斯的很好的例子。

  1. 从分布中找到先验和
  2. 在更新每个击球手的估计值之前使用它。

这对基于现有数据量的加权平均值和缩小低数据观测值接近平均值具有显着效果。

我们如何更新计数正常情况的估计值。我假设 Gamma 用于计数,Gaussian 用于正常,但如果有人有的话,我很想在 R 中看到这样的例子。

0 投票
1 回答
529 浏览

r - R中的箱线图比较不同样本量的95%置信区间的结果

我试图通过使用自举来显示 gamma 分布的样本大小对 95% 置信区间边界的影响。现在,我需要将 4 个不同样本大小的结果放在一个箱线图中。R代码如下:

0 投票
1 回答
767 浏览

r - About Gamma density simulation

I am simulating some gamma random numbers

The first plot

The second plot

enter image description here

I need to simulate this kind of gamma with some tail, the mean around 1200. I have been selecting random numbers in order to get that values considering the definition of expectation and variance for gamma distribution, but in the first case I get negative numbers, I don't want that. In the second case the same but also in both plots the probability in the y axis is so low, I would like to increase this probability but I don't know how to select the adequate parameters to get that.

On the other hand the parameters given in the third plot gives a density strange, because the probability in the y axis is greater than one I can get values greater than 1. I don't understand this.

0 投票
1 回答
313 浏览

r - R中的归一化下不完全伽玛

我试图在 R 中重现本文的结果但我被困在两个部分。

  1. 绘制归一化的下不完全伽马函数 在此处输入图像描述

  2. 计算损失函数

在此处输入图像描述

如果 R 中存在计算normalized lower incomplete gamma function. 所以我的问题是,如何计算归一化的下不完全伽玛函数

0 投票
1 回答
782 浏览

r - 用 R 拟合流的伽马分布

您好,我有过去 100 年的月平均流量:

我正在尝试使用以下函数将 Gamma 分布拟合到数据中:

它给出了一个错误:

优化中的简单错误(par = vstart,fn = fnobj,fix.arg = fix.arg,obs = 数据,gr = 梯度,ddistnam = ddistname,hessian = TRUE,method = meth,lower = lower,upper = upper,.. .): 非有限差分值 [2]> Error in fitdist(Sep, distr = "gamma", method = "mle") : 函数 mle 无法估计参数,
错误代码为 100

我正在使用包

任何帮助将非常感激

0 投票
2 回答
91 浏览

python - 伽玛分布的Python隐蔽x轴单位

我有一个形状和比例参数为 2.126、0.370 的伽马分布。

您可以使用以下代码绘制它:

这些参数最初是用来描述从家到公共交通节点的步行距离,单位为km。现在我想将单位转移到m.

我怎样才能保持相同的形状,只是x Axis.在新的形状和比例参数应该是什么的单位上有所不同?

更清楚地说,我希望 x 轴刻度变为 500、1000、1500 ... 而不是 0.5、1、1.5 ...

0 投票
0 回答
320 浏览

r - Gamma 分布的矩方法 - 直方图和叠加 PDF

我有这个问题。'将 nfsold 中的数据(nfsold 只是一个包含 150 个数字的向量)建模为来自 Gamma(lambda; k) 分布的 150 个独立观察值的集合。使用矩量法来获得 k 和 lambda 的估计值。绘制数据的直方图并叠加拟合伽马分布的 PDF,作为该分布与观测数据匹配的初步检查。

这是我写的代码。

我的问题是我的叠加曲线没有跟随我的直方图,所以我觉得我的代码有问题,请问我能得到一些帮助来纠正它吗?

谢谢!

0 投票
2 回答
814 浏览

matlab - 如何计算伽玛分布中的中位数?

我有以下分布,我想计算中位数:

分布可视化