# Lesson 11 - Exercise: Creating Correlations Using Functional Relationships

In the previous Lesson we looked at an Example in which we expressed a correlation between inputs by using a correlation coefficient. In practice, however, assessing and quantifying correlations in this manner can be difficult. A more practical way of representing correlations is to explicitly model the cause of the dependency. That is, the analyst adds detail to the model such that the underlying functional relationship causing the correlation is directly represented.

In this Exercise, we will modify the Example we worked on in the previous Lesson to do just that. If you don’t already have the model from the previous Lesson open, open it now (go to the “Examples” subfolder of the “Basic GoldSim Course” folder you should have downloaded and unzipped to your Desktop, and open the model file named Example15_Correlation.gsm).

Recall that in that model, we had two inflows to the Pond: Inflow1 and Inflow2. These were represented by Stochastic elements and were correlated (using a specified correlation coefficient). In this model, we are going to replace those two Stochastics with two Expressions (with the same names and Display Units of m3/day). Instead of modeling the inflows as Stochastics, we are going to model each inflow as a function of an Average Rainfall, an Area, and a Runoff Coefficient:

Inflow = Average Rainfall * Area * Runoff Coefficient

Conceptually, we are saying that each inflow is determined by the rainfall rate (mm/day), the surface area onto which it is falling (km2), and the fraction of that rainfall that runs off and discharges into the pond (this is a dimensionless fraction).  The rainfall rate will be a Stochastic, and both inflows will be a function of this. Each inflow, however, has a different area and a different runoff coefficient.  The areas are Data elements (they are known), but the runoff coefficients will be Stochastics.

The inputs are as follows:

• The Mean_Rainfall for the area is defined as a Stochastic, having an Exponential distribution with a Mean of 1 mm/day.
• Inflow1 has an associated area (Area1) and an associated Runoff Coefficient (RunoffCoeff1).
• Inflow2 has an associated area (Area2) and an associated Runoff Coefficient (RunoffCoeff2).
• Area1 and Area2 have values of 0.003 km2 and 0.004 km2, respectively.
• RunoffCoeff1 and RunoffCoeff2 are defined as Triangular distributions. Both have a Minimum of 0.4, a Most Likely of 0.8 and Maximum of 0.9.

Stop now and try to build but don’t run the model yet.

Once you are done with your model, save it to the “MyModels” subfolder of the “Basic GoldSim Course” folder on your desktop (call it Exercise17.gsm). If, and only if, you get stuck, open and look at the worked out Exercise (Exercise17_ Correlation.gsm in the “Exercises” subfolder) to help you finish the model.

To build this model, you should have done the following:

1. Deleted Inflow1 and Inflow2.
2. Created a Stochastic named Mean_Rainfall and defined it as an Exponential distribution.
3. Created two Data elements (Area1 and Area2).
4. Created two Stochastics (RunoffCoeff1 and RunoffCoeff2), defined as Triangular distributions.
5. Created an Expression named Inflow1 (with Display units of m3/day) defined as Mean_Rainfall*Area1*RunoffCoeff1.
6. Created an Expression named Inflow2 (with Display units of m3/day) defined as Mean_Rainfall*Area2*RunoffCoeff2.

The model should look like this: Note that Inflow1 and Inflow2 are not directly linked to each other (as they were when they were represented by Stochastics and were directly correlated).  In fact, we have not defined any correlation coefficients at all in this model.  But as we shall see, Inflow1 and Inflow2 are in fact correlated.

To see this, we need to run the model. But before you do so, delete any Multi-Variate Result elements in the model (e.g., Uncertainty Analysis).  Because we deleted some of the entries, these elements will no longer be valid (we could easily fix them, but we won’t bother to do that here; just delete them).

Now run the model.  After doing so, right-click on Inflow1 and select Multi-Variate Result…  Press OK in the next dialog.  Then from the browser that is displayed, select Inflow2. The following 2D Scatter Plot will be displayed: As can be seen, Inflow1 and Inflow2 are strongly correlated. In fact, if you press the Correlations button, you can view the resulting correlation coefficient: This correlation was created not by specifying a correlation coefficient between Stochastics, but by explicitly representing the functional relationship between Inflow1 and Inflow2: they are both dependent on the Mean_Rainfall.