Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
The median is the middle of a distribution: half the scores are above the median and half are below the median. The median is less sensitive to extreme scores than the mean and this makes it a better measure than the mean for highly skewed distributions. The median income is usually more informative than the mean income, for example.
The sum of the absolute deviations of each number from the median is lower than is the sum of absolute deviations from any other number. Click here for an example.
The mean, median, and mode are equal in symmetric distributions. The mean is typically higher than the median in positively skewed distributions and lower than the median in negatively skewed distributions, although this may not be the case in bimodal distributions. Click here for examples.
Computation of Median
When there is an odd number of numbers, the median is simply the middle number. For example, the median of 2, 4, and 7 is 4.
When there is an even number of numbers, the median is the mean of the two middle numbers. Thus, the median of the numbers 2, 4, 7, 12 is (4+7)/2 = 5.5.
Mean, median, and mode are three kinds of "averages". There are many "averages" in statistics, but these are, I think, the three most common, and are certainly the three you are most likely to encounter in your pre-statistics courses, if the topic comes up at all.
The "mean" is the "average" you're used to, where you add up all the numbers and then divide by the number of numbers. The "median" is the "middle" value in the list of numbers. To find the median, your numbers have to be listed in numerical order, so you may have to rewrite your list first. The "mode" is the value that occurs most often. If no number is repeated, then there is no mode for the list.
The "range" is just the difference between the largest and smallest values.
Find the mean, median, mode, and range for the following list of values:
13, 18, 13, 14, 13, 16, 14, 21, 13
Note that the mean isn't a value from the original list. This is a common result. You should not assume that your mean will be one of your original numbers.
The median is the middle value, so I'll have to rewrite the list in order:
13, 13, 13, 13, 14, 14, 16, 18, 21
There are nine numbers in the list, so the middle one will be the (9 + 1) ÷ 2 = 10 ÷ 2 = 5th number:
The largest value in the list is 21, and the smallest is 13, so the range is 21 – 13 = 8.
mean: 15
median: 14
mode: 13
range: 8
Note: The formula for the place to find the median is "( [the number of data points] + 1) ÷ 2", but you don't have to use this formula. You can just count in from both ends of the list until you meet in the middle, if you prefer. Either way will work.
Find the mean, median, mode, and range for the following list of values:
1, 2, 4, 7
The mean is the usual average: (1 + 2 + 4 + 7) ÷ 4 = 14 ÷ 4 = 3.5
The median is the middle number. In this example, the numbers are already listed in numerical order, so I don't have to rewrite the list. But there is no "middle" number, because there are an even number of numbers. In this case, the median is the mean (the usual average) of the middle two values: (2 + 4) ÷ 2 = 6 ÷ 2 = 3
The mode is the number that is repeated most often, but all the numbers appear only once. Then there is no mode.
The largest value is 7, the smallest is 1, and their difference is 6, so the range is 6.
mean: 3.5
median: 3
mode: none
range: 6
The list values were whole numbers, but the mean was a decimal value. Getting a decimal value for the mean (or for the median, if you have an even number of data points) is perfectly okay; don't round your answers to try to match the format of the other numbers.
Find the mean, median, mode, and range for the following list of values:
8, 9, 10, 10, 10, 11, 11, 11, 12, 13
The median is the middle value. In a list of ten values, that will be the (10 + 1) ÷ 2 = 5.5th value; that is, I'll need to average the fifth and sixth numbers to find the median:
(10 + 11) ÷ 2 = 21 ÷ 2 = 10.5
The mode is the number repeated most often. This list has two values that are repeated three times.
The largest value is 13 and the smallest is 8, so the range is 13 – 8 = 5.
mean: 10.5
median: 10.5
modes: 10 and 11
range: 5
While unusual, it can happen that two of the averages (the mean and the median, in this case) will have the same value.
Note: Depending on your text or your instructor, the above data set may be viewed as having no mode (rather than two modes), since no single solitary number was repeated more often than any other. I've seen books that go either way; there doesn't seem to be a consensus on the "right" definition of "mode" in the above case. So if you're not certain how you should answer the "mode" part of the above example, ask your instructor before the next test.
About the only hard part of finding the mean, median, and mode is keeping straight which "average" is which. Just remember the following:
mean: regular meaning of "average"
median: middle value
mode: most often
(In the above, I've used the term "average" rather casually. The technical definition of "average" is the arithmetic mean: adding up the values and then dividing by the number of values. Since you're probably more familiar with the concept of "average" than with "measure of central tendency", I used the more comfortable term.)
A student has gotten the following grades on his tests: 87, 95, 76, and 88. He wants an 85 or better overall. What is the minimum grade he must get on the last test in order to achieve that average?
The unknown score is "x". Then the desired average is:
(87 + 95 + 76 + 88 + x) ÷ 5 = 85
Multiplying through by 5 and simplifying, I get:
87 + 95 + 76 + 88 + x = 425
346 + x = 425
x = 79
On a chart you have at least five different options to calculate a median. Let us for example take a lookback period of 7 bars.
(1) Take the seven bar high and the seven bar low and calculate (high + low)/2. This is a statistical 2-point-median.
(2) Median of the Closes: Take the seven closes and calculate a median from those seven closes. This is a statistical 7-point-median.
(3) Median of all the data points the bars contain: Take the seven opens, seven highs, seven lows and seven closes and calculate a statistical median from 28 data points.
(4) TPO - Median: Take every single tick from the seven bars and then calculate the median from all the single ticks (each tick can be observed up to seven times, depending on whether it is contained in one of the seven bars).
(5) Volume-weighted TPO Median: Proceed as under (4) but count each tick k times, if k is the volume of the bar it belongs to.
The medians (2) -> blue, (4) -> red and (5) -> green are shown in the chart below. The anaSuperTrend currently uses the Median(2), but it can easily be recoded to use (4) or (5) as well. Note that the median (5) deviates from the other medians. That can be explained by the fact that it is the only one that has a volume component.
It has a second reverse OnBarUpdate coded within OnBarUpdate. This will increase CPU time by a factor 100 or 1000, depending on the chart lookback period, don't know. Try it out and put it on your chart, I am afraid to do so.