Skip to content

How to get average

jfoclpf edited this page Jan 12, 2016 · 8 revisions

The DB has a lot of inputs from several users and some inputs belong to the same user. The main functions to obtain the average are in statsFunctions.js

  1. Many inputs belong to same user, so there is need to calculate the averages of the average. Therefore we find two for loop cycles. The i cycle refers to a matrix with unique user ids for the specific country, while the j cycle refers to a matrix with all the information provided on the DB for that specific country;

  2. It is checked if the entry does not come from a spam-bot. Therefore the first input from the user, must be greater than MIN_TIME_TO_FILL_FORM, considering spam-bots tend to fill the forms in very quickly. The threshold was given through analysis of the respective chart;

  3. Then, the calculation is made using the function calculate_costs from coreFunctions.js;

  4. The average of the averages is calculated and the result is outputted.


Array A on the left represent unique users (i loop) while array B on the right (j loop) has all the information.

Clone this wiki locally