Tennisfan
Tennisfan

Reputation: 25

How to calculate cumulative distibution functions in matlab

How to solve the following problem, not quite sure how to do it, using the MATLAB functions: binocdf, normcdf, expcdf:

This is given:

X1 ∈ Bin(10, 0.3), X2 ∈ N(5, 3), X3 ∈ Exp(7)
k = 1, 2, 3

What is this probability P(3 < Xk ≤ 4) = ?

I know that the cumulative distribution function gives you the probability of a stochastic variable of being less than or equal to the input if you use for example:

binocdf(4,10,0.3) = P(X1 ≤ 4) 

But how do I use these functions when it's Xk > 3?

Upvotes: 0

Views: 387

Answers (1)

rayryeng
rayryeng

Reputation: 104575

If you remember the properties of a CDF, you can find the probability of an event of a random variable spanned by an interval [a,b] by simply substituting each end point into the CDF and subtracting the two quantities. Concretely, given f being the PDF and F being the CDF of a random variable X, calculating the probability of the event occurring P(a < X <= b) is such that:

Source: Wikipedia

Therefore, to compute P(3 < X1 <= 4) as for your example, do:

out = binocdf(4,10,0.3) - binocdf(3,10,0.3);

I'll leave it to you to figure out the other ones.

Upvotes: 2

Related Questions