---
title: "Coding model elements for clarity"
canonical: "https://modelassist.epixanalytics.com/space/EA/26575286/Coding%20model%20elements%20for%20clarity"
format: markdown
---
At EpiX analytics we use a standard formatting to promote good model housekeeping and helps us and others more easily navigate the model. We have also used this standard throughout the example models in ModelAssist.

 

# Output

Outputs of your model are the variables that you wish to study. You may have several outputs in the one model; they may be calculations, they may be single cells or cover a range. You may select intermediary calculations as outputs for checking purposes too. You will notice that we color all of our outputs red for ease of identification.


# Input

Inputs can be either parameter values that are used in probability distributions or probability distributions themselves. They come from data or expert opinion. Our preference is to have only parameter values as inputs. For example, an expert might offer the opinion that you will sell Pert(300, 400, 600) units of a product. We would treat the three figures as three inputs (instead of one cell with the Triangular formula and its parameters) and construct the model to ensure that all three values are visible. We color all our input parameters blue. 

 

Our coloring convention has all calculations with Excel in black (Excel's default). You can also add the convention that all placeholders (values you don't yet know) with a background color that stands out well.

 

For models that will be distributed to others, we offer a key to allow the reader to easily identify these components. We try to keep the key, together will all assumptions and outputs in the first sheet of the workbook. In fact, in general we try to keep a model to just one sheet, sometimes with data held in other sheets, because this helps avoid reference errors.

 

# Software facilities

Excel provides a set of default formatting "Styles", under the Home menu. These can be easily changed to your needs. 


Monte Carlo simulation software have built-in capabilities to automatically format stochastic inputs and outputs. For example, in Crystal Ball if you select an output via the "Define a forecast" button, the cell is automatically formatted to light blue, and if you create an input distribution using the "Define distribution" button, the cell is green colored. In @RISK, one can change the setting to a user-defined color scheme of choice, which can be found under the "Utilities→Color Cells" section. 


For models developed using code and/or scripting languages (e.g. R, Matlab), there are many options available but in general just using standard naming conventions and abundant commenting of the code can facilitate the review of code. For example, using  "Inp_" and "Out_" for  input and variable names respectively can help not only with reviewing the code but also to sort and group those variables. For code that needs to be maintained and documented, using automated documenting facilities such as [Doxygen](http://www.doxygen.nl/) can really speed up the documentation and maintenance of a model.