# Correlating input and output in Monte Carlo simulations

## Main Question or Discussion Point

I'm pretty ignorant when it comes to statistics, so I'm hoping that there's an easy answer to my question (this is the good part of ignorance):

If I have run a set of Monte Carlo simulations of some process, where I have some set of input parameters that I've drawn from known distributions, and then some set of output variables, how do I correlate the outputs vs. the inputs? Specifically, if I have one output variable that I suspect depends strongly on just a couple of the inputs and is largely insensitive to the rest, is there a simple procedure I can apply to show this?

Related Set Theory, Logic, Probability, Statistics News on Phys.org
Dale
Mentor
You should be able to calculate the http://en.wikipedia.org/wiki/Covariance" [Broken]matrix with most software packages. This will not only tell you if some of the inputs depend strongly on some of the outputs, but it will also tell you if some of the outputs are strongly related to each other. If your input distributions are independent then you can also look at that as a "reality check".

Last edited by a moderator:
Hi, again, DaleSpam (you're my new best buddy),

I figured that I was looking for a covariance matrix, but I've never calculated one where the independent variables were drawn randomly. In other words, I'm used to situations where I have a bunch of inputs that I vary one at time, so that I can see exactly how each of the outputs changes in response to the change in that one input. That gives me approximations of partial derivatives with respect to that input variable.

In my case, however, I have a set of "cases", in each of which all of the input parameters are varied. That means I can't just say, "when I change x_1 by delta, y_3 changes by this much" since all the x's were changed and I can't say (by looking at that individual run) which ones were more or less responsible for any given change in y. (x and y are my inputs and outputs, as you probably guessed.)

My gut tells me that I need to express the delta for each x as a variation from its mean value, and correlate that to the variation of each y from its mean. That should tell me which y's really jump when certain x's are tweaked hard. Wait .... did I just describe the covariance matrix .... hang on - I've got to go think this through.

Thanks, you might have just given me the push I needed to work this out.

Okay - I'm done thinking! I don't know why I was thinking about partial derivatives ... except that not too long ago I wrote an optimization routine that would iteratively perturb a set of inputs in order to achieve a desired set out outputs, which it does by use of the matrix of partials. I believe that's generally called a sensitivity matrix, and it's really a different beast from a covariance matrix.

Anyway, once I remembered what a covariance matrix actually is, it was clearly all I needed.

thanks again.

Dale
Mentor
You are welcome! Yeah, I didn't think that matrix of partial derivatives would be what you needed if you are doing a Monte Carlo.