mean list
This command reports the mean of numbers in the given list, summation of numbers is performed and then divided by the total number of items in the list.
- Using the command: mean[3 9 6 2]
- Using manual calculation: (3 + 9 + 6 + 2) / 4 or sum[3 9 6 2] / length[3 9 6 2]
To do this manually:
- Get the sum of numbers.
- Divide the resulting number by the the size or length of numbers. If you added 5 different numbers, then divided it by 5.
- Or, use both sum[] and length[] commands.
variance list
This reports the sample variance of a list of numbers. In NetLogo, please take note that this command computes an unbiased estimate of the variance for a sample, rather than for a whole population, using Bessel's correction.
- Using the command: variance [3 9 6 2]
- Using manual calculation: ((-2 * -2) + (4 * 4) + (1 * 1) + (-3 * -3)) / 3
To do this manually:
- Get the mean of numbers. In the example above, the mean is 5.
- For each number: subtract the mean and square the result. So for the first number, 3 - 5 = -2. Then the squared result is -2 * -2.
- Get the sum of the squared differences and divide it by one less than the number of items in the list.
standard-deviation list
A command that reports the sample standard deviation of a list of numbers. In NetLogo, like variance, please take note that this command computes an unbiased estimate of the variance for a sample, rather than for a whole population, using Bessel's correction.
- Using the command: standard-deviation[3 9 6 2]
- Using manual calculation: show sqrt(((-2 * -2) + (4 * 4) + (1 * 1) + (-3 * -3)) / 3)
- Get the variance of numbers.
- Then, just take the square root of the resulting number from Step 1.
0 comments:
Post a Comment