0

I'm relative new to C# and doing a project using Monte Carlo Simulation. Basically my question is the following.

I have two uncertain variable inputs, A and B, and they will go through a model and give an output C. So C = f(A,B). I know A's probability distribution (Triangular) and B's probability distribution (Discrete). How can I get the probability distribution of C?

What I have done now is that I can generate random numbers based on A's triangular distribution as well as B's discrete distribution. Each pair of randomly generated A and B gives a resultant C. I've run this model 1000 times thus I can get 1000 possible values of C. The difficulty is to get the corresponding probabilities of each value of C. Obviously it's not 1/1000 unless C is uniformly distributed. Is there any Monte Carlo Simulation package/library I can use?

1
  • 1
    Smells like a homework question. Anyhow, you dont need a package, you need a book abuot statistics and monte carlo, as you havep roblem with the maths. Commented Feb 14, 2011 at 8:35

2 Answers 2

2

Put them in a histogram.

For example create 1000 bins, each corresponding to a small interval. Then run the model TotalN=1000000 times and count how many values fall in each interval.

Then calculate n[i]/TotalN/WidthOfBin to get the approximate probability density in that interval.

Sign up to request clarification or add additional context in comments.

Comments

0

To gain an intuitive understanding of the concepts covered in the question, read The Flaw Of Averages by Sam Savage. It provides example code, demo projects, and spreadsheets showing how to model the question above.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.