How to calculate probabilities using Bayesian theorem

조회 수: 9 (최근 30일)
Ricardo Duarte
Ricardo Duarte 2022년 2월 4일
답변: Pratyush 2023년 12월 14일
Dear all,
I would like to calculate the probability of A, given B (p(a|b)) which can be done through the Bayesian theorem: p(a|b)=(p(b|a)/p(b))*p(a).
Im considering that: p(a)=normpdf(A) and p(b)=normpdf(B)
However, I'm not sure how to calculate p(b|a).
Can anoyone give me a hand on this?
Thank you in advance.
  댓글 수: 4
Ive J
Ive J 2022년 2월 5일
I assume by "working with matrices" you mean each random variable is stored in a different column of the matrix, with rows being the observations. In that case, you still can follow the link above.
Ricardo Duarte
Ricardo Duarte 2022년 2월 5일
I would like to say that each variable is a different matrix (24 x 36).

댓글을 달려면 로그인하십시오.

답변 (1개)

Pratyush
Pratyush 2023년 12월 14일
Hi Ricardo,
I understand that you want to calculate ( P(A|B) ) using Bayes' theorem.
To do that you need ( P(B|A) ), ( P(A) ), and ( P(B) ). In MATLAB, "normpdf" can be used to calculate the probability density function (PDF) for ( P(A) ) and ( P(B) ), but this gives the density, not the actual probability.
For ( P(B|A) ), you need to know the relationship between ( A ) and ( B ):
  • If ( A ) and ( B ) are independent, ( P(B|A) = P(B) ).
  • If ( A ) and ( B ) are dependent, you need their joint distribution to calculate ( P(B|A) ).
Without knowing how ( A ) and ( B ) are related or having their joint distribution, you cannot calculate ( P(B|A) ). Additional information about their covariance or relationship is required to proceed with the calculation.

카테고리

Help CenterFile Exchange에서 Classification에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by