0
votes

I am looking for a more convenient way to gather statistics on an agent population, not only on agents that currently live, but also on the agents that have been removed from the model.

To my understanding, creating a statistic in the Statistics area in the properties of an agent population only takes into account the living agent instances.

The Basic Health Economics model in the example model library gathers statistics on all Person agents who have ever lived in the model.In this model, Quality-adjusted Life Years (QALYs) are calculated. This metric is Quality of Life * Time. In that specific model, in Person, a variable called QoL holds the value for the Quality of Life that is associated with the health state the Person instance currently is in. Using a statistic in the population properties field, the QoL of each agent is summed, which is then used as a flow in SD stock and flow as the NewQALY per year flow.

It feels tedious and inefficient that making use of a SD flow for each statistic I want to have that also includes 'past' agents. Does anyone have a better approach than the one in the Basic Health Economics model?

1

1 Answers

1
votes

what about this? (following the QoL metric):

  1. You create a statistics element called QoLStats (from the analysis palette)
  2. You create an event running cyclically every year

In your event you do:

totalQoL=sum(population,p->p.QoL);
QoLStats.add(totalQoL);

You have to create a new statistics element for each statistic you want to collect... maybe you will want to use the dataset element instead depending on what info you want to collect.