MATLAB: How to compute the probability of a function of random variables using the Statistics Toolbox 7.4 (R2007a)

Statistics and Machine Learning Toolbox

I have random variables S, X1, X2, X3, B with known means and variances. I would like to compute the probability
Pr(F > 0)
where,\n

F = S - k * B * (X1 + X2)/X3

for some constant k.
I would like to solve this for different assumptions. Specifically,
1. All variables including F are Gaussian
2. All variables are Gaussian except F which does not need to be Gaussian
3. All variables have different distributions.

Best Answer

The Statistics Toolbox in MATLAB has a number of functions for evaluating PDF's and CDF's of a number of distributions, fitting data to certain distributions and generating random data from a set of distributions. These distributions and functions are listed at,
Some combination of these functions and Monte Carlo simulations can be used to compute the probability in this application. In all cases, you will need to make certain assumptions on the covariances of B, X1, X2, X3 and S.
Task 1:
If you know the mean and standard deviation of F you can use the function NORMCDF to compute the probability that F > 0 (using 1-NORMCDF(...)). The mean and variance of F may, in some cases, be found analytically in terms of the means and variances of B, X1, X2 and X3 depending on the assumptions you make about those random variables' distributions and covariances. However, the toolbox will not be able to assist you in this task.
In general, MATLAB's strength lies in its ability to generate and handle large amounts of data. Therefore, Monte-Carlo simulation would be the preferred way to solve this problem. You can generate a large number of random numbers from the joint distribution of B, X1, X2, X3 and S. For Gaussians, the MVNRND function can be used for this purpose using the means and covariances of the random variables. You can then compute values of F for all these variables and fit the resulting data to another Gaussian using NORMFIT. You can then compute the probability using NORMCDF. There are also other functions in the toolbox that can help you determine the goodness of the fit.
Task 2:
As before, generate a number of random values drawn from B, X1, X2, X3 and S using their joint multivariate distribution and compute the corresponding values of F. Then instead of fitting a Gaussian, you can simply compute the ratio of positive values of F giving you an estimate of the probability. You can also fit the data to a number of other distributions supported by the toolbox with fitting functions. You can then use the corresponding CDF function to compute the probability.
Task 3:
You can no longer use MVNRND to generate the random data, but you will need to generate it from some other joint distribution. If the variables are independent, this makes it much easier as the random numbers from each random variable can be generated independently. If they are correlated, you may wish to use COPULARND to generate random data from their joint distribution. The rest of the operations are the same.