聯合概率分布怎么求

文章插圖
求聯合概率分布公式:F(x,y)=P{(X隨機變量(randomvariable)表示隨機試驗各種結果的實值單值函數 。隨機事件不論與數量是否直接有關,都可以數量化,即都能用數量化的方式表達 。
兩組離散數據怎么聯合概率的方法分析給定至少兩個隨機變量X,Y,…, 它們的聯合概率分布(Joint probability distribution)指的是每一個隨機變量的值落入特定范圍或者離散點集合內的概率. 對于只有兩個隨機變量的情況, 稱為二元分布(bivariate distribution).
聯合概率分布可以使用聯合累計分布函數(joint cumulative distribution function), 連續隨機變量的聯合概率密度函數(joint probability density function)或者離散變量的聯合概率質量函數(joint probability mass function)來描述. 由此又衍生出兩個概念: 邊緣分布(marginal distribution)和條件概率分布(conditional probability distribution).
二. 離散變量的聯合概率質量函數公式
公式:
是給定X=x的Y=y的條件概率.
而且有:
如果X和Y相互獨立:
【聯合概率分布怎么,兩組離散數據怎么聯合概率的方法分析】如果X和Y條件不獨立(conditionally dependent):
P(X=x and Y=y)=P(X=x)·P(Y=y|X=x)
也可以使用聯合累計分布函數的差分來計算:
聯合累計分布函數定義是:
所以F(x,y)的導數(差分)就是P(X=x and Y=y)
三. 使用Matlab計算離散2D聯合分布
參考: Calculating a 2D joint probability distribution
離散2D聯合分布可用于計算兩張圖片的互信息MI.
0. 定義兩個離散的隨機變量.
有N個點分布在邊長為1的正方形區域內. 把正方形分為K1*K2的小矩形. 統計每個小矩形內的點的個數.
% Data
N = 1e5; % number of points
xy = rand(N, 2); % coordinates of points
xy(randi(2*N, 100, 1)) = 0; % add some points on one side
xy(randi(2*N, 100, 1)) = 1; % add some points on the other side
xy(randi(N, 100, 1), :) = 0; % add some points on one corner
xy(randi(N, 100, 1), :) = 1; % add some points on one corner
inds= unique(randi(N, 100, 1));
xy(inds, :) = repmat([0 1], numel(inds), 1); % add some points on one corner
inds= unique(randi(N, 100, 1));
xy(inds, :) = repmat([1 0], numel(inds), 1); % add some points on one corner
% Intervals for rectangles
K1 = ceil(sqrt(N/5)); % number of intervals along x
K2 = K1; % number of intervals along y
int_x = [0:(1 / K1):1]; % intervals along x
int_y = [0:(1 / K2):1]; % intervals along y
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
1. 從定義出發, 使用for循環:
tic
count_cells = zeros(K1, K2);
for k1 = 1:K1
inds1 = (xy(:, 1) >= int_x(k1)) & (xy(:, 1)
inds2 = (xy(:, 2) >= int_y(k2)) & (xy(:, 2)
end
end
toc
% Elapsed time is 39.357691 seconds.
1
2
3
4
5
6
7
8
9
10
11
1
2
3
4
5
6
7
8
9
10
11
推薦閱讀
- 三分鐘讀懂分布式能源,分布式能源項目是什么
- IBF是什么單位
- 亞寒帶針葉林分布在哪
- 經濟聯合社是怎樣產生的
- 寧夏人口分布特點
- 多學科聯合門診是什么意思
- 聯合國兒童基金會月捐怎么弄
- 世界人口分布特點
- 降水概率55表示什么
- 什么是冪律,正態分布疊加公式
