Measurement is the heart of statistics but most people think of it as calculating. So here is how to calculate statistics.
How To Calculate Basics
N & n. Capital N for a population or total number of people in a study. Lowercase n for number of scores in a sample or subsection of a study.
Mini & Max. Min is the smartest or minimum score of a group. Max is the largest or maximum score of a group. Both are useful for finding input errors. If scores are supposed to be from 1 to 5, a maximum value of 44.5 indicates something is wrong.
Totals are just sums. Add up the scores.
Data Matrix is a row-column table of scores.
How To Calculate Percents & Percentiles
Percents are portions of a larger group. Ten percent of 100 candies is obtained by randomly selecting 10 candies. And 87% would be 87 candies.
Percentiles are cumulative percents. The 10th percentile is the bottom 10 percent of scores. The 90th percentile is the cumulative 90 percent. A percentile takes no space for itself. At the 87th percentile has 87% of the scores below it and 13% of scores above it.
How To Calculate Degrees of Freedom
Degrees of Freedom is a component of an F table, in which a Sum of Squares is divided by its appropriate degrees of freedom (df) to get mean squares. Basically there are three formulas: N-1 (for total mean squares and k-1 (for between mean squares. Within degrees of freedom is N-k; total number of people minus the number of columns.
How To Calculate Central Tendency
Central tendency are measures that try to represent an entire distribution of scores with one number. This is easy if everyone has the same score; difficult if there are lots of different scores.
Calculate: Mean
-
- Sum (add) all of the scores in a variable
- Divide that sum by the number of scores in the distribution.
You probably already know this formula. A mean is the average of scores. We like to use it becuase we don’t have to arrange the scores in any particular order before calculating it. We just add up all the numbers and divide by the number of scores. In statistical vocab we “sum” the numbers and divided the sum by N (the number of scores).
∑X/N
Calculate the mean of these numbers:
7
6
5
5
5
4
3
The sum of the variable called X is 35. That is
∑X = 35
N (number of scores) is 7.
The mean of these scores is calculated by dividing 35 by 7. So, the mean of these scores is 5. That is:
X̄ = 5
Calculate: Median
Finding the median in a distribution of integers is relatively easy. When there is an odd number of scores: it is the one left over when counting in from either end. When there are an even number of scores, the median is whatever the middle two scores are (if they are the same) or the halfway point between the middle-most two scores when they differ from each other.
Medians are most often used when distributions are skewed. Indeed, when data is presented in medians, ask about the means. If they are quite different, the distribution is highly skewed, and the sample may not be as representative as you would like.
A median requires that we put the numbers in order (from high to low, or low to high). The median is the score in the middle (if there are an odd number of scores) or the average of the two middle-most scores (if there are an even number of scores). That too much work, so we prefer the mean.
There is no easy formula for median. To calculate the median, arrange the scores in order of magnitude from high to low or from low to high (it doesn’t matter which one you choose). Select the score in the middle.
Take these number, and arrangement from high to low:
2
9
4
7
8
Here they are arranged in a distribution:
9
8
7
4
2
Find the score in the middle. In the following numbers, the median is 7:
9
8
7
4
2
Calculate: Mode
The mode is the most popular score (most common). If you plot a distribution, the mode will be the highest spot on the distribution. It will be the top of the mountain. If your mountain has more than one peak, the distribution will be bimodal (2 high spots) or multimodal (several high spots).
There are two ways to calculate this popularity.
First, the mode may be found by sorting the scores and selecting the one most frequently given.
The mode of this distribution is 5:
11
9
5
5
5
2
Second, and more practical in a distribution of many scores, the mode is the highest point on a frequency distribution. If a frequency distribution is accurately drawn, both approaches will yield the same result.
When we make a distribution, the scores are arranged from left to right, with the lowest scores on the left and the highest scores on the right. When everyone has the same score, the distribution is a straight horizontal line. When more than one person has the same score, the scores are stacked vertically. Consequently, a distribution where everyone had the same score would be represented by a straight vertical line.
How To Calculate Dispersion
Dispersion is amount of diversity or spread of scores. Distributions of small dispersion are easy to summarize with a measure of central tendency. The more similar the scores the easier it is.
Range
A quick and easy measure of dispersion, range is the highest score minus the lowest score. Sometimes range is described as including a half value above and before the actual scores, to account for rounding. For example, a high score of 8 and a low score of 1, would give a range of 7. Alternatively, if including rounding the range would go from .5 to 8.5, giving a range of 9. Neither version of range is very helpful. Aside from a quick look, range doesn’t generalize from one distribution to another, and doesn’t lend itself to mathematical manipulation.
Mean Variance
If you sub tract the mean from every score, adding them up gives you zero. There is always an equal amount of deviation above and below the mean. Always.
Trying to take an average of deviations is equally useless. It is always zero. So you can square the deviations or take their absolute value.
Mean Absolute Variance (MAD)
Not widely used, the MAD starts with subtracting the mean from each score, taking the absolute value of those score (ignore the positive and negative signs, just add the scores) and dividing by N. It’s not used because of all the rounding errors that occur then you subtract the mean, and all the rounding errors of taking the average. Also there are no fun mathematical manipulations easily used.
Sum of Squares
SS Deviation Method. This is great for understanding what Sum of Squares means but no one uses this method in real life. Way too many rounding errors. Subtract the mean from each score, square those deviations, and add them up. Extremely tedious to do by hand.
SS Raw Score Method. This is the way Sum of Squares is calculated. Here is the formula.
You need three things to calculate the SS (sum of squares): the total of one column, the total of another column, and the number of scores in each column (they have to agree; no fair having columns of different length). Sum of Squares is easy to calculate. Plus it’s one of the most useful measures of dispersion.
Like range, variance and standard deviation, Sum of Squares (SS for short) is a measure of dispersion. The more inconsistent the scores are (less homogeneous) the larger the dispersion. The more homogenous the scores (alike), the smaller the dispersion.
Using the formula above, let’s go through it, step by step Assume this is the distribution at issue:
X
12
6
5
4
5
10
3
First, each number is squared, and put into another column:
X X2
12 144
6 36
5 25
4 16
5 25
10 100
3 9
Second, we sum each column. The sum of the first column is 45. This is called the sum of X. The sum of the second column is the sum of X-squared. Remember, we squred the scores and then added them up. The sum of the squared-X’s is 355.
Third, we square the sum of X (45 times itself = 2025) and divide it by N (number of scores). Since N = 7, we divide 2025 by 7 (which equals 289.29).
Fourth, we recall the sum of the X2 and subtract 240.67 from it. So 355 minus 289.29 = 65.71. The Sum of Squares is 65.71.
Variance
Divide Sum of Squares by N, if it is a population. Divide by by N-1 if it is a sample.
Standard Deviation
Take the square root of variance.
How To Calculate z Score
How To Calculate Independent t-Tests
There are correlated t-tests for repeated measures (multiple trials with the same subjects) but they are better handled with multiple regression techniques. Our focus is the independent t-test, used when subjects are randomly assigned to two groups. Two groups that are independent of each other, like a treatment and control group.
‘We’re going to use a variation of the z score formula. Basically we are going to use two means instead of a raw score and a mean/ The interpretation is the same. If the two means are close together, we will assume they are from the same population. We will keep this null hypothesis until the difference is so large it is “significant “ and can’t be ignored. A significant difference makes it likely the means come from different populations.
Calculate am independent t-test for the following data:
X1 X2
5 3
11 5
8 4
12 2
9 6
Mean of group 1 is 45/5 = 9
Mean of group 2 is 20/5 = 4
Difference between the means is 9-4 = 5. Plus or minus doesn’t matter.
‘There is a difference but is it significant? To find out, we divide the difference by the groups’ “pooled variance,” a combination of their respective variance.
Calculate the SS for each group. Ss1 = 30. SS2 = 10.
Add them together. 30+10 = 40
Divide by n times n-1. So 5 times 4.
Divide the pooled SS by the combined n vale’s. That is, 40 divided by 20 = 2.
Take the square root of the pooled variance. The result is a standard deviation of pooled variance. In this case, take the square root of 2, which equals 1.41.
Divide the difference between means by our pooled standard deviation; 5 divided by 1.41. The result is t.
Divide the difference between the means by this pooled standard deviation. The result is t.
t = 3.54
Yeah, we know what t is! But we don’t know if it is significant.
We compare the t we calculated to the value in a table of t values. If our t is equal to or higher than the table, it is significant.
We use a table because t values depend on how many people are in the study. The more people you have, the smaller the critical value needed. If you only have a few people, you want to make sure that you don’t decide something is significant when it isn’t.
If you have thousands of people in each group, you only need a t value of 1.96 (two tailed) to be significant. Two tailed test are the most common because we want to know if the mean of a group is significantly higher AND is it is significantly lower. One tailed tests once check one direction. The critical value for a one tailed t test with thousands of participants is 1.65.
To get the right value, we need to know how many people were in the study. If we have 5 in each group, N = 10. We subtract k (the number of columns) from this; so 10-2 = 8.
Here is a table I made. It is unrelated and only for instructional use. But the critical value listed is 2.31.
Our calculated value is 3.54, which is larger than 2.31. We would conclude there is a significant difference between the two means. The difference is unlikely to be due to chance.
How To Calculate Correlation
For the sake of simplicity, we’ll restrict ourselves to the Pearson r, the most commonly used type of correlation. A correlation is a ratio between togetherness and individuality. To calculate8 the Pearson, three Sum of Squares are needed. The Pearson r is the ratio of SSxy to the squareroot of the product of SSx and SSy. Here is the formula:
You need three things to things to calculate Pearson’s r (correlation coefficient): sum of squares for variable X, sum of squares for variable Y, and a sum of squares you make yourself.
You already know how to calculate the SS of X and the SS of variable Y. They are just regular old sum of squares.
The SSxy, however, is a bit different. First, we have to make a new variable: XY. To do so, we multiply each X by its respective Y. Now we have 3 columns: X, Y and XY. Second, sum the XYs. Third, use this formula:
Notice that this formula is a lot like the regular formula for Sum of Squares; it’s a variation on the theme. It’s the sum of the XYs but we don’t have to square them (they’re already big enough). And we don’t square the Sum of X; we multiple the Sum of X and the Sum of Y together. Fourth, finish off the formula and the result is the Pearson r.
Let’s try an example. We create a new variable by multiplying every X by its Y partner. So this:
X Y
2 17
13 3
10 4
3 18
2 19
12 11
Make a culm for XYs
X Y XY
2 17. 34
13 3. 39
10 4. 40
3 18. 54
2 19. 38
12 11 132
Then, we sum each column. The sum of X = 42, the sum of Y = 72, and the sum of XY is 337.
Calculate the SS for X (136) and the SS of Y (256). And calculate the SS of XY. Multiple the sum of X by the sum of Y (42 * 72 = 3024). Now divide the result by N (the number of pairs of scores = 6); 3024/6 = 504. Subtract the result from the Sum of XYs (337-504 = -167.
Notice the SSxy is negative. It’s OK. The SSxy can be negative. It is the only Sum of Squares that can be negative. The SSx or the SSy are measures of dispersion from the variable’s mean. But we created the XY variable; it’s not a real variable when it comes to dispersion. The sign of SSxy indicates the direction of the relationship between X and Y. So we have a negative SSxy because X and Y have an inverse relationship.
Look at the original data: when X is small (2), Y is large (17). When X is large (13), Y is small (3). It is a consistent but inverse relationship. It’s like pushing the yoke down and the plane going up.
Let’s finish off the calculation of the Pearson r. Multiple the SSx by the SSy (136 * 256 = 34816). Take the square root of that number (sqrt if 34816 = 186.59). Divide the SSxy (-167/186.59 = -.895). Rounding to 2 decimal places, the Pearson r for this data set equals -.90. It is a strong, negative correlation.
We can evaluate the strength of a correlation in two ways.
First, we can use the coefficient of determination as a quick assessment of how much we understand. Simply square r and interpret it as a percentage. If r = .8. r2 = .64. This indicates we have accounted for 64% of the variance. Of course, it also means we have not accounted for 36% of the variance. The coefficient of non-determination is 1-r2.
Second, we can test the significance of a correlation by comparing our value to one in a table. Here is a table I created for instructional purposes. You need to know the value of r, and how many people were in the study. Remember there are two measures on each person; it is the number of participants we need, which is half of the number of scores. Don’t double count. Use N-2 as your degrees of freedom.
If our correlation coefficient is .34, and we have 20 people in our study(so df is 18), the critical value to meet or beat is..44. Our correlation is not significantly different from chance.
How To Calculate Regression
We’re going to focus on linear regression. There are other models available but we’re going to test our data to see if it appreciates a straight line.
Here is the formula for a straight line.
A is the starting point. B is the slope. X is any raw score you want to use as a predictor. Y’ is the predicted value.
We start by figuring out slope, which is the angle of the line. A positive b value indicates that for every increase in X there is an increase in Y. A negative b indicates that when X increases, Y decreases.
Here is the formula for b:
It is just the SS of XY (think correlation) and the SS of X.
And a is the means of each variable combined with b.
Of course there is a formula:
4 7
6 6
9 8
12 14
15 11
15 12
How To Calculate Analysis of Regression (AOR)
We can test the goodness of fit of a regression. This is a test of how well our data fits the straight line model. It uses an F test, like an ANOVA.
We are going to make a ratio of regression divided by error. That is F = msRegression ÷ msError. Of course, ms is SS divided by its appropriate degrees of freedom. So it is a ratio of variances.
You need four things to calculate an ANOR (analalysis of regression): the XY correlation coefficient (Pearson r), the number of columns (k), the number of people in the study (N), and the SS of Y (assuming X is predicting Y). From these, you can calculate an F value which you compare to a value you look up in a table.
Here is a set of data to play with:
X Y
11 1
4 2
8 8
2 12
7 11
16 2
When we are done, we have filled in a summary table like this one:
SS df ms
Regression _____ ____ ____
Error _____ ____ ____
Total _____ ____ ____
There are six people in the study; 2 measures on the same people. The total degrees of freedom are N-1, so 6 minus 1 equals 5.
The df for regression is k-1 (columns minus 1. Two minus one equals 1.
The df for error is total minus regression, which is 4.
Here is where we are so far:
SS df ms
Regression ____ 1 ____
Error _____ 4 ____
Total ____ 5 ____
The SStotal equals the SS of Y. In this case it is 122.
The SSregression is calculated bu multiplying SSregression by the coefficient of determination (the square of Pearson’s r). The correlation between X and Y in this case is .56. Consequently, r-squared is .34, and the SSregression is 41.14.
The Sserror is the correlation coefficient multiplied by the coefficient of non-determinism (1 – r-squared). You check your work by subtracting the SSregression from the SStotal.
Here is where we are:
SS df ms
Regression 41.14 1 ____
Error 80.86 4 ____
Total 122.00 5 ____
To complete the summary table, divide each SS by its appropriate df.
SS df ms
Regression 41.14 1 41.14
Error 80.86 4 20.21
Total 122.00 5 25.20
The F statistic is the mean squares of Regression divided by the mean squares of Error. So F = 41.14 / 20.21. When divided through, you get: F = 2.04.
Here is a table I created of selected values, useful only for instructional purposes.
We test the significance of this F by comparing it to the critical value in the F Table. We enter the table by going across to the dfregression (1) and down the dferror (in this case it’s 4).
So the critical value = 7.71. In order to be significant, the F we calculated would have to be larger than 7.71. Since it isn’t, the pattern we see is likely to be due to chance.
How To Calculate Analysis of Variance (ANOVA)
A 1-Way ANOVA pre-tests variance to see if further analysis is allowed. It is risky to do multiple t-tests because one might look significant when it is not. ANOVA keeps us from making that error.
It is a F test, so it is a ratio of variances. In this case, the amount of variation between groups (due to treatment effect) and the amount of variation with the groups (random error).
F = msBetween ÷ msWithin
You need to complete a calculation table, a summary table and an F score that you compare pair to the critical value in an F table. And you need to do a lot of basic math steps. No one really calculates one-way ANOVAs by hand, except for illustrative purposes. This is a task computers are good at. But walk through the steps a couple of times and you’ll gain a real feel for how the statistic works.
One independent variable can have several levels, such as high, medium and low. In this example there are four levels, still only one independent variable. Eventually, we will complete a summary table and test for F. But first we’ve got some calculating to do.
Here is the general approach.
1. Summarize the subgroups
First, find the n (number of scores) for each group.
Second, find the sum for each group.
Third, square each number in the first group and sum them. Then square and sum the scores in each of the other groups.
Fourth, find the Sum of Squares (SS) for each group.
Fifth, find the totals for n, sum, squares, and SS. So, N = 20 (the sum of each group’s n’s). The SumX = 117 and so on.
Updating our example, it would look like this:
Group1 Group2 Group3 Group4
1 6 12 5
2 4 7 2
4 9 15 6
3 5 9 3
2 11 7 4
n 5 5 5 5 20
Sum 12 35 50 20 117
Squares 34 279 548 90 951
SS 5. 20 34 48 10 97.20
2. Find SSwithin
First, start by creating a summary table.
Second, write in the SSwithin. In the process of creating summarizing the groups, the SSwithin was calculated. It was 97.2. That is, SSwithin (within the experiment) is the sum of the SS that is in (within) each group.
Updating our summary table, it now looks like this:
SS df ms
Between ____ ___ ____
Within 97.20 ___ ____
Total ____ ___ ____
3. Find SSbetween
The formula for SSbetween looks more difficult than it is. Here’s the formula:
First, start with the sum of each group (12, 35, 50, 20). Square each of them and add them together:
122 + 352 + 502 + 202
So we get: 144 + 1225 + 2500 + 400 = 4269.
Second, divide Step1 by the n (the number of subjects in each group. NOTE: It is not the number of groups but the number of scores in each group. This gives us: 4269 divided by 5 = 853.8.
Third, take the Sum of X in the totals column (117) and square it, which equals 13689.
Fourth, divide Step3 by the N in the totals column (20). That is, 13689 divided by 20 = 684.5
Fifth, subtract Step4 from Step2. So, 853.8 – 684.5 = 169.35. This is the SSbetween.
Updating our summary table, it now looks like this:
SS df ms
Between 169.35 ___ ____
Within 97.20 ___ ____
Total ____ ___ ____
4. Find SStotal
The formula for SStotal is the same as any basic SS.
First, note that the sum of X-squares = 951.
Second, take the sum of X’s (117) and square it. This equals 13689.
Third, divide Step2 by 20 (big N), which equals 684.5
Fourth, subtract Step3 from Step1. That is, 951 – 684.5 = 266.55. This is the SStotal.
Updating our summary table, it now looks like this:
SS df ms
Between 169.35 ___ ____
Within 97.20 ___ ____
Total 266.55 ___ ____
To check the calculations, simply add SSbetween to SSwithin and see if they equal SStotal. It does, so we calculated everything correctly.
5. Find the degrees of freedom
First, enter the degrees of freedom (df) for Between, which is k-1 (columns minus one). Since our example has 4 columns, the df for Between = 3.
Second, enter the df for Within, which is N-k (number of people minus the number of columns). In our example, N = 20, so dfwithin = 16.
Third, enter the df for Total, which is N-1 (number of people minus one). So, dftotal = 19.
SS df ms
Between 169.35 3 ____
Within 97.20 16 ____
Total 266.55 19 ____
6. Find F
First, calculate the appropriate mean squares. Since mean squares is another name for variance (and SS divided by df equals variance), divide each SS by its respective df. Updating the table, we now have:
SS df ms
Between 169.35 3 56.45
Within 97.20 16 6.08
Total 266.55 19 14.03
Second, divide the mean squares of Between by the mean squares of Within. That is, 56.45 divided by 6.08 = 9.29. This ratio is called the F test, so F = 9.29.
7. Find the critical value
The Critical Values of the F Distribution table is actually a series of distributions. To enter the table, go across to the row whose number matches the degrees of freedom for Between (dfbetween). And go down the dfwithin.
In our example, go across to 3 and down to 16. The critical value (the value you have to beat) = 3.24 (at the .05 alpha level).
8. Decide what to do next
If F is not significant, there is nothing else to do. The differences between the groups is due to chance.
If F is significant, than t-tests are done: one between each pair of combinations (AB, AC, AD, BC, BD and CD).
To test for significance, the calculated value is compared to the F table. If the value you calculated is bigger than the value in the book, F is significant. In our example, we calculated F to be 9.29, which is bigger than the critical value of 3.24 we found at 3 and 16 degrees of freedom. So, F is significant and the t-tests are authorized.
Square One Videos
Want to jump ahead?
- What is statistics?
- Ten Day Guided Tour
- How To Calculate Statistics
- Start At Square One
- Practice Items
- Resources
- Final Exam
Book
Statictics Safari