Indexing Records at Random vs. Sequentially

RSS

Indexing Records at Random vs. Sequentially


The purpose of this model is to demonstrate two different ways to index a data record for use in a GoldSim model. In this example, the data happens to be in a spreadsheet but the same approach could be implemented on data stored inside a model (in a data element matrix).

In this model, there exists a data set with 1000 rows. The model selects a single row on each realization of the model. The data happens to be in the form of a vector, so it is segregated out into individual parameters from the vector so each parameter can be viewed (and used) individually.

The Random and the Sequential methods are described below.

Random Method

The random method is implemented by creating a stochastic element that generates a random index number between 1 and 1,000. This number is used to index the data table to select a given row from the table. For example, if the stochastic element results in the number 439 on a given realization, then the model will go to the data table and extract the data from row 439. The stochastic (called, "Selector_Pathway") uses a discrete distribution with each value of 1 through 1,000 having equal chance of being chosen. The probability of any single row being chosen is 0.01. This row value is used in the Spreadsheet element for the import value's properties under Offset. If you look at the offset for this value, you will see the element "Selector_Pathway" is used here.

Sequential Method

The sequential method is implemented by indexing each row of the data table by an incremental offset value. This value is obtained from the model property called ~Realization, which is simply the count of realizations in the model running in Monte Carlo mode. If the model is set to run for 1,000 realizations, the the first realization will be assigned 1 and the next a 2 and so on. This numbering is assigned in sequential order so the data being extracted from the data table will import in a sequential basis. If 2,000 realizations are run in the model, the model will import rows 1-2000 in the table in order.

Download the model file


  • Accompanying Excel file: DataWLQ.xls
  • size: 530K
  • Download: DataWLQ.xls

See Also

 

Making Better Decisions In An Uncertain World

RSS RSS

Navigation (Model Library)






Search the wiki
»

PoweredBy