Independence of two random variables having datasets

4 ビュー (過去 30 日間)
Shankul Saini
Shankul Saini 2023 年 2 月 6 日
コメント済み: Shankul Saini 2023 年 2 月 9 日
Hi there, I hereby have two random varibles data sets names y1 and y2. I am stuck at the checking of their independence using matlab(or in any other ways), can someone help for the corresponding steps..
The correlation between these two random varibles is zero.
for ii=1:10^6
h=sqrt(0.5)*(randn(4,4)+1i*randn(4,4));
g=sqrt(0.5)*(randn(4,4)+1i*randn(4,4));
y=g*h;
y1(ii)=y(1,1);
y2(ii)=y(1,2);
end

採用された回答

Dongyue
Dongyue 2023 年 2 月 8 日
If two vactor x and y are linearly dependent, there should exist ax + by = 0, so you only have to check:
clear; clc;
result = true;
for ii=1:10
h=sqrt(0.5)*(randn(4,4)+1i*randn(4,4));
g=sqrt(0.5)*(randn(4,4)+1i*randn(4,4));
y=g*h;
%check whether xi1/xi2==yi1/yi2
if real(y(1,1))/imag(y(1,1)) ~= real(y(1,2))/imag(y(1,2))
result = false;
break
end
end
result
result = logical
0
  1 件のコメント
Shankul Saini
Shankul Saini 2023 年 2 月 9 日
Thanks @Dongyue, yeah that solves the problem.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePortfolio Optimization and Asset Allocation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by