问题标签 [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 回答
1495 浏览

python - 使用 matplotlib 绘制 3D 概率分布

我有一个 1024x1024x1024 矩阵,它类似于 3D 空间,每个单元格对应于空间中的一个点。该矩阵的每个元素都有一个值,该值决定了该坐标中粒子存在的概率。

我想用 matplotlib 绘制一个三维概率分布。我在 2D 中使用 imshow 执行此操作,但我不知道如何在 3D 中制作它。

谢谢

0 投票
3 回答
8197 浏览

python - Python中给定PDF的随机数

我想生成一个整数随机数,其概率分布函数以列表形式给出。例如,如果 pdf=[3,2,1] 那么我喜欢 rndWDist(pdf) 返回 0,1 和 2,概率分别为 3/6、2/6 和 1/6。我为此编写了自己的函数,因为我在随机模块中找不到它。

有没有更短的方法来达到相同的结果?

0 投票
1 回答
1162 浏览

r - 带有 ggplot 和 R 的 2D Normal PDF

我正在尝试使用 ggplot 制作轮廓/图像图,但到目前为止还没有成功。

考虑 R 中的以下代码,它创建一个z具有二元法线 PDF 的矩阵:

2D 法线 pdf 图像图

是否可以z使用 ggplot 绘制矩阵?

谢谢!

0 投票
1 回答
286 浏览

matlab - MATLAB如何将概率密度向量绘制到直方图上?

我目前有一个计算概率密度的向量,即

probden = (0.0008, 0.0016, 0.0048, 0.0064, 0.0072, ... , 1.0936, ... , 0.0072, 0.0064, 0.0048, 0.0016, 0.0008)

计算出的概率密度列表应呈正态分布。

我也有每个概率密度的 bin 的相同长度列表。

我正在尝试创建一个直方图,以便每个概率密度都反映在 X 轴上的每个 bin 上。

如果我使用函数 hist,它只显示每个 bin 中有多少概率密度。

我应该如何继续处理这个问题?

谢谢!

0 投票
1 回答
2814 浏览

matlab - 如何根据矩绘制分布

我想知道如何在 Matlab 中绘制具有以下信息的连续 pdf?

或替代方法如何绘制不正常的连续pdf?(就像它是偏度和峰度等)

谢谢!

0 投票
1 回答
904 浏览

matlab - Given a uniform distribution of a variable, use a function of random variables to plot the probability density function MATLAB

I have a question about using MATLAB to find the probability density function. The question is about the range of a cannon projectile with gravity, g = 9.8 m/s, and velocity, v = sqrt(980) m/s. The angle, theta, is a uniformly distributed random variable between 0 and pi/2. I have to plot the uniform distribution of theta and the probability density function of the range fr(r) using the function of a random variable and the mean distance of the projectile.

So far, I have used the equation from physics, r = V^2*sin(2*theta)/g, to figure out the mean and sigma. sigmatheta = (pi/2)/sqrt(12) and meantheta = pi/2/2 Simplifying the equation, r = 100*sin(2*theta). I know the uniform distribution, ftheta(theta) goes from 0 to pi/2 and equal to 2/pi, .6366. The following code was given as an example for uniform and probability density function plotting. I have replaced the numbers I saw fit pertaining to this specific question. Using the formula, g(meantheta) + sigmatheta^2/2 *(g''(meantheta)), the mean of r should be 58.87, but the plot shows 63.65, so I already see there may be some errors in the code or my understanding of the problem. fr(r) is the probability density plot for the range of the projectile.

The uniform distribution plots correctly, but I seem to have an error with the probability density function. I was wondering if I could get some help fixing it.

p.s. Sorry for the long background information thank you!

0 投票
1 回答
144 浏览

r - 密度图显示点之间的条纹(R ggplot2)

嗨,当只有几个点时,我的密度图会显示点之间的条纹/凹陷,请参见这张图片:

http://www.imagesup.net/?di=3141413124212

有人知道如何解决吗?

0 投票
2 回答
4102 浏览

python - 在 Python 中用于条件密度估计的工具

我有一个大型数据集,每行包含 3 个属性:A、B、C

A 列:可以取值 1、2 和 0。 B 列和 C 列:可以取任何值。

我想使用 P(A = 2 | B,C) 的直方图执行密度估计,并使用 python 绘制结果。

我不需要代码来做到这一点,我可以自己尝试解决。我只需要知道我应该使用的程序和工具吗?

0 投票
0 回答
317 浏览

matlab - MATLAB 中是否有用于图像处理的特定条件概率函数?

我正在尝试在 MATLAB 中开发运动估计图像处理算法,并且作为我正在关注的论文的一部分,我需要最大化每帧的条件概率密度函数。

我的问题是,MATLAB 中是否有专门用于图像处理的 pdf 函数,或者统计工具箱中的 pdf 函数是否可以工作?

我将不胜感激任何帮助!

谢谢!

0 投票
1 回答
1089 浏览

matlab - 如何在 MATLAB 中从样本集中查找 PDF

我有一些来自未知来源的观察。这组观察值是 x,例如:

如果 x 足够大,我应该可以说一下概率分布函数,对吧?

那么我怎样才能在 MATLAB 中做到这一点,这样我才能得到p(x = 101)or p(x = 5)?第一个可能会非常高。

任何类型的假设(正态分布等)都可以,我只想要一个简单的概率答案。也许我不必明确知道PDF,我只需要一种实现方式p(x = x_star),其中x_star不一定是x的成员。我怎样才能做到这一点?

谢谢你的帮助 !

我的尝试

最简单的尝试是length(find(x==x_star))/length(x),但是如果例如101观察中没有,则返回零。然而,从分布来看,它应该是一个很高的概率。

编辑 :

根据 Kamtal 的回答,我的功能:

p返回[]。我在哪里做错了?