Integration in Matlab for calculating if two distributions are significantly different
Show older comments
Dear community,
i am starting to use matlab for integration. More specifically, i have to find the likelihood that a Probability distribution A is greater than a probability distribution B (i.e. P(A - B>0). (I can not use ttests and the like for specific reasons, so i have to resort on probability principles).
Both distributions A and B resemble normal distributions (albeit not perfect in some cases). i basically need to solve the following (sorry for the notation)
p = INTEGRAL [-Inf,+Inf] of g(B) * INTEGRAL [min real value of B, +Inf] f(A) in db da.
i have tried the following code, but i am not sure that it does what i actually want him to do:
fun2 = @(y) normpdf(y,m_a(i), sd_a(i)); fun3 = @(x,y) (normpdf(x,m_b(i),sd_b(i)))*(integral(fun2, min_b(i), Inf(i)))
q(i) = integral (fun3, -Inf,Inf)
i have done the same by explicitly writing the equation for the normal distribution down and have the same results.
Any help would be greatly appreciated.
jacopo
1 Comment
Walter Roberson
on 12 Sep 2013
I am not sure what you are asking of us? To confirm your fun2/fun3/integral lines?
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!