问题标签 [probability-density]

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 回答
1360 浏览

c++ - 计算速率参数:指数分布

我有一组遵循指数分布的值。现在,我想计算速率参数 alpha。任何人都可以帮我计算它(我正在使用 c++ 对其进行编码)吗?

0 投票
2 回答
2185 浏览

r - 给定一个经验概率密度函数,如何找到密度峰值的值(在 R 中)?

我计算以下数据的密度函数:

这给了我这个结果:

在此处输入图像描述

我想找到两个密度峰值的位置。我最初考虑使用diff()onmyden$y然后检查所有有符号变化的位置,以此作为选择 X 轴值的条件。我在一些测试向量上进行了尝试,但没有得到预期的结果,我怀疑它并不是那么简单。

有没有一种简单的方法可以做到这一点?我想要一个可重复的解决方案,因为我将作为随机模拟研究的一部分进行此操作,实现约 e+05 次,并且可能会发生峰值数量在模拟中发生变化的情况。

0 投票
2 回答
944 浏览

math - 如果它们呈指数分布,如何对 0 和 R 之间的 N 个点进行采样?

我的点 x ∈ [0,R] 的密度是指数的: ρ(x)~e^x 我如何从那里采样 N 个点?

谢谢,

0 投票
3 回答
7719 浏览

c++ - 使用标准库的概率密度函数?

能够使用std <random>来生成不同概率分布的随机数很棒......现在,有没有办法使用标准库计算给定分布及其参数的一组数字的概率?

我知道我可以自己为任何分布编写概率密度和质量函数(参见下面的单个随机变量示例),但如果可以的话,我宁愿使用标准库。

0 投票
1 回答
274 浏览

python - 2D kernel density e. in python - x axis crowded and shrinked

I have a x,y distribution of points for which I obtain the KDE through scipy.stats.gaussian_kde.

Both kms and mins are a list with float values representing the time needed to cover the amount of kilometres.

The values are distributed between:

  • mins: [3.48996296296 - 317.678638298]
  • kms: [0.180707205317 - 8086.94362983]

In the result I will get a high and narrow line -- the y values are shown normally, but the x-axis is very narrow and shrunken (the ticks are overlapping). Can somebody point out how the x axis can be more stretched?

Here is my code to generate the plot:

And here is the plot itself:

enter image description here

0 投票
2 回答
3400 浏览

r - 从密度函数生成随机变量

如果我有密度函数,如何生成大小为 n= 2914 的随机变量?

所以问题是我有密度 f(x) (函数定义明确)

我想我需要反转并使用蒙特卡洛,我不知道该怎么做?

0 投票
2 回答
14111 浏览

python - 如何在python中绘制概率质量函数

如何创建一个直方图,显示给定数字 x 范围从 0-1 的数组的概率分布?我希望每个条形图都 <= 1,并且如果我将每个条形图的 y 值相加,它们应该加起来为 1。

例如,如果 x=[.2, .2, .8] 那么我会期望显示 2 个条形图,一个在 0.2 处高度为 0.66,一个在 0.8 处高度为 0.33。

我试过了:

这给了我一个柱状图超过 1 的直方图。我并不是说这是错误的,因为根据文档,这是规范参数将执行的操作,但这并没有显示概率。

我也试过:

这也给了我 y 值总和大于 1 的条形图。

0 投票
1 回答
2837 浏览

matlab - 在matlab中绘制概率密度函数

我有一个 1x4225 向量,它的元素介于 0 和 1 之间,我想在 matlab 中绘制它们的概率密度函数。在问题的情况下,ksdensity()概率有时会超过 1。我还尝试了下面的代码来做到这一点:

但是由于我的数据量很大,它制作了一个由一些垂直线组成的模棱两可的图,对我来说毫无用处。那么有没有办法解决这个问题或在matlab中以任何其他方式来解决这个问题,将每个元素显示为pdf图中的一个单独的点?

0 投票
3 回答
6278 浏览

matlab - 计算二维联合概率分布

我在一个正方形中有很多点。我想将正方形划分为许多小矩形并检查每个矩形中有多少点,即我想计算点的联合概率分布。我正在报告几种常识方法,使用循环并且效率不高:

如何在时间、内存和可能避免循环方面更有效地做到这一点?

编辑 -->我也刚刚找到了这个,这是迄今为止找到的最好的解决方案:

但它需要统计工具箱。

编辑 --> chappjc 建议的测试解决方案

0 投票
1 回答
1389 浏览

matlab - How to extract fitted data from normal probability density function

If I fit a uni-variate data with normal distribution, how can i get back the fitted values in MATLAB. I am using this simple example

yval is giving the probabilities of xval values. Now, If I would like to extract the fitted values of 'x' after approximating it with the above normal distribution, how do I do that?. As can be seen in the picture the y-axis values are the pdf and lies between 0 and 1, however I want the corresponding fitted values from the data that follows normal distribution.

Would the fitted values be x_fitted = yval*sigma + mu? !I think I am missing some basic maths here.