Skip to main content

Entity Statistics

Icon

EntityStatistics_image1.png

Function

The Entity Statistics component calculates custom expression indicators for entity properties based on the specified method.

Examples
  • You can calculate the average wealth of a user population. Note that the wealth value is a property that belongs to Individuals within the user population.
  • You can calculate the median rate of return for individuals within a trader population. Here, Individual RoR = Current Profit (an Individual property) / Current Cost (an Individual property).

Mechanism of Entity Statistics

  • The component specifies the entities for statistics, the indicators to be calculated, and the statistical method.
  • First, the system calculates the indicators for each entity using the given expression. Then, it utilizes the specified statistical method to aggregate these indicators. This process leads to the final statistical results.
  • You can set multiple statistical values. Each value follows the above mechanism.

Setting Methods

EntityStatistics_image2.png

Targets

  • A new expression input field is added by clicking on the "Add Target" button.
  • The input field accepts an expression that returns a value in [Entity] format.
  • During statistical analysis, the system considers all statistical targets specified by the expressions in each field.

Values

EntityStatistics_image3.png

Add New Value

Click "Add Value" to add a new statistical value unit as shown above.

Local Keywords

By default, the system uses Entity as the local keyword for the statistical target. This keyword is used in statistical indicator expressions for subsequent entity properties. You can change the default local keyword if needed.

Define Indicator

Enter a number-returning expression into the input field. This expression should depend on a certain property of the entity, constructed as Entity.property_name.

EntityStatistics_image4.png

Name the Value

The entered name content will be used as the key to access in the future in the format of statistics_component_name.key_name.

EntityStatistics_image5.png

Choose Method

From the dropdown menu, select how the system will calculate the indicators of all objects within the entity.

EntityStatistics_image6.png

  • Max: Maximum value
  • Min: Minimum value
  • Avg: Average value
  • Median: Median value
  • StdDev: Standard deviation
  • Sum: Sum
  • Count: Distinct count; multiple identical values are counted only once.

Outputs

  • The Entity Statistics components output each statistical value in number type.
  • Here's how to access the statistical results:
    • Subsequent components in the process can use the statistics_component_name.statistics_value_name format.
    • Computations after this component's actions can use the This.statictics_value_name format.

Example

Model Example

Consider three traders who start with a principal amount of 1000, 2000, and 3000, respectively. After trading, their current assets become 1100, 1800, and 3600, respectively. The average return on investment, calculated statistically, is 6.67%. The formula to calculate individual return on investment is (Current Asset / Principal Amount) - 1.