Showing posts with label Standard Deviation. Show all posts
Showing posts with label Standard Deviation. Show all posts

Friday, 30 November 2012

Statistics - The Normal Probability Distribution

This post will bring in an application of standard deviation. It can help give us units to measure distances between points in a data set as well as to measure the distance from the mean.

Chebyshev had a theorem. He said that for any set of observations, the minimum proportion of values that lie withing k standard deviations of the mean is 1- (1/k^2), as long as k is greater than 1. If k is 3, 89% of the observations lie withing the region and if k is 4, 94% of observations lie within the region.

For a normal probability distribution we need to use a normal curve, or a bell curve. It has a single peak in the centre of the distribution. This centre point is where the mean equals the median equals the mode. We can now introduce a new concept of z-values. A z-value is the distance between a selected value (Xi) and the population mean, divided by the population standard deviation. Another note on the normal curve is that is has a Kurtosis of 0. A higher Kurtosis means it's peak is higher and more pointy, a lower Kurtosis means it's a flatter shape.

Back to the z scores. They link together the theoretical normal distribution to the observed observations. It tells us how many standard deviations away from the mean an observation lies. So, we need to calculate the z-score. When calculating the z score it is essentially converting your data into a distribution with a mean of 0 and a normal curve shape. The formula is as follows:


Once the score has been calculated, you refer to a z score table. On this table, the first decimal goes down the side and the second decimal goes along the top. So, if using the formula above you were given a z score of 1.24, then you'd look for 1.2 down the side and 0.04 along the top. The score at which these match is your z score. That score is 0.3925. What to do with that score becomes more understandable with an example and some context. 

At a party, lemonade is distributed among the party-goers with a mean of 20cl and a standard deviation of 5cl. What is the likelihood that a person selected at random will get between 17cl and 23cl of lemonade? Right, so we plug in the values to start. z will equal (17 - 20) / 5 = -0.6. It will also equal (23-20) / 5 = 0.6. Now, from here we look for 0.6 down the side of the z score table and 0.00 along the top. We will be given a value of 0.2257. This score caters for one of the results, but as they are both the same size we can double it and get 0.4514. And that's the answer. 45.14% of people get between 17 and 23cl of lemonade, so the likelihood of any given person getting between that amount is 45.14%.

Another use for z scores isn't just finding the amount included, it can be used to find excluded regions too. That may sound quite complex, but I'll show you a picture to visualise it.


We need some context once again to work this out. Let's say that a teacher has said to achieve an A* on a test, students must get in the top 10% of the scores. The mean score for the test was 75 and there was a standard deviation of 5. We can now work out what score is needed to get a A*. The whole region to the right of the mean makes up 50%, we know we want to exclude 10%, so we need to find a z-score that marks 40% - 0.4. On the z-score table 0.4 doesn't appear (remember this time we know the size of the region, so we are looking at the values in the table and looking for a corresponding z score), 0.3997 is the closest so we'll go with that. That gives a z-score if 1.28. Now we need to refer back to the z score formula. We know z, we know s and we know the mean... we are trying to work out Xi. So, we plug in the numbers we have an rearrange to find Xi. 1.28 = (Xi - 75) / 5. Xi - 75 = 6.4. Xi = 81.4. There we have it, the answer. To make it more realistic this score could be rounded to 81 or 82, but one of these scores is needed to achieve the top 10% of the class and therefore get an A*. Simples!

That's it from me, z-scores are a fairly complex topic so feel free to ask any questions if i haven't been entirely clear in the explanation. Good luck!

Sam.


Tuesday, 27 November 2012

Statistics - Measures of Dispersion

The first measure of dispersion of data we'll mention is the range. The range is the difference between the highest value and the lowest value in a set of data. Only these two values are used in the calculation and it is very easy to compute. It has a slight issue, however, that extreme values do influence the result. 

A step on from this range is the interquartile range. This is the difference between the first quartile and the third quartile - giving us the middle 50% of observations. To work out the first quartile, we take N (number of observations) and divide it by 4. This will give us the number of the observation at which the first quartile point is. To work out the third quartile we take N and divide it by 4 and then multiply the result by 3. This gives us the number of the observation at which the third quartlile mark is. From there, we just subtract the value of the first quartile figure away from the third quartile figure. 

The quartiles are then displayed on a box plot diagram. A box plot will look generally as follows:


Mean deviation is another measure of dispersion. This measures the mean of the absolute values of the deviations from the mean. Similar to standard deviation, but not quite. The formula is as follows:

  • Mean Deviation = (Σ|Xi - x̄|) / n
  • Xi = each observation
  •  = the sample mean.
  • n = number of observations.

We take the absolute values here for a very specific reason. It stops the negative and positive values from cancelling each other out, which would give us a mean deviation of close to 0 - very unhelpful! Dispersion is very important, key statistical methods such as regression rely heavily on measures of dispersion. 

The population variance and sample variance are two more concepts I'm going to introduce now. The population variance measures the arithmetic mean of the squared deviations from the population mean. The sample variance essentially does the same, but for a sample. The formula for both are as follows:

  • Population variance = (Σ|X - μ|)^2 / N
  • Sample variance = (Σ|Xi - |)^2 / (n - 1)

These variances can be easily turned into the standard deviations, a very important concept for statisticians. To do this, we just square root the result. We denote the standard deviation of a population and a sample differently. A population is given with this symbol: σ and a sample is given with the letter s. The standard deviation principle will come in key in the next few posts when we begin to introduce confidence intervals, so learn it!

Thanks for reading, have a good day.
Sam.


Monday, 26 November 2012

Statistics - Measures of Central Tendancy

By the end of this post I hope that you'll be able to characterise a data-set with one piece of information  and more importantly briefly describe complex data in simple terms. 

We'll start with the mean. The mean is computed by adding up all the values and dividing by the number of observations there are (N or n). Two symbols appear for means, these are x̄ (sample) and μ (population). If you take each score in a distribution and subtract the mean from it, and add all these differences the sum will always be 0. The mean does have some disadvantages, such as extreme scores pulling the mean one way or another. This issue doesn't occur with the median. To work out the population mean, or μ, all data in that population must be added up and divided by the population. For the sample mean, or x̄, all sample data must be added together and divided by the number of observations in the sample. 

A different type of mean to the arithmetic mean above is a weighted mean. This allows us to create accurate calculations even when all the information isn't known. It's fairly straight forward, like above. The formula for weighted means is as follows: x̄ = (w1X1 + w2X2 + ... + wnXn) / (w1 + w2 + ... + wn). 'w' here denotes the weight given to the value 'X', the higher the weight the more influence it has on the mean. If the weights are all 1 you essentially have the same formula for as the arithmetic mean in the previous paragraph. The problem with this is that sometimes the weights aren't known and outliers are very common in economics. 

Next, we move on to the median. This, as many already know, is the middle score when the observations are arranged in order. If there is an even number of scores, it's the mean of the middle two values. There is a unique median for each set of data. It isn't affected by extreme values and is therefore a very good measure of central tendency. 

The logical step now is to introduce the mode. The mode is the most frequently appearing value in a data-set. It is of limited use because it doesn't give any weighting to unique values. Other problems arise, such as some data having no mode and some having more than one. It really doesn't give a good measure of central tendency for a set of data. 

Skewness! A few graphs will crop up in this section. Skewness tells us in which direction the data swings, it is normally represented graphically. We start off with the bell curve. This is when the mode = median = mean, we have no skew and the data fits nicely into this 'bell' shape shown below. The distribution is symmetrical. 



A positively skewed distribution occurs when the mode < median < mean. The data is all bunched to the left of the mean and then it falters out. It looks like below.


Finally, the negatively skewed distribution. It's the stark opposite of above, the mean < median < mode. Here it is. 


You might have worked out by now, by skewness measures the lack of symmetry of the distribution. This lack of symmetry can be given a numerical value ranging from -3.00 to 3.00. A value of 0 indicates a symmetric distribution. It is worked out as follows: sk = 3(x̄ - Median) / s. 's' stands for standard deviation which will be coming up in the next blog post, so stick around for that. 

That's all for this post. I hope now you're able to describe your data set fairly easily, tell us the middle value, the average in which direction it's skewed and so on and so forth. It's a good tool to have, yet still very basic. We'll be stepping up another gear next post as range and deviations are introduced. Keep checking back, thank you guys!

Sam.