|
|
|
|
|
Calculating the de-trended CV from raw count data |
|
|
The de-trended CV is calculated by first doing a linear regression and calculating the
standard deviation of the residuals. This standard deviation is then divided by the
mean of the counts. Steps 1 through 4 on this page show how a linear regression is done
one example count data. Steps 5 and 6 show how the residuals are calculated, and Step 7
shows how the standard deviation and coefficient of variation are calculated. |
|
|
| Step 1: Determine mean
year and mean count |
|
Step 2: Subtract means
from values (i.e. subtract mean
year from each year value etc.) |
|
Step 3: Square and
multiply subtracted values from Step 2, and sum them |
|
Explanation of terms: |
| Year (x) |
Count (y) |
| 1974 |
1.0 |
| 1975 |
4.0 |
| 1976 |
3.0 |
| 1977 |
3.5 |
| 1978 |
2.0 |
| 1979 |
4.0 |
| 1980 |
3.0 |
| 1981 |
2.0 |
| mean |
mean |
| 1977.5 |
2.8125 |
|
|
| x - mean x |
y - mean y |
| -3.5 |
-1.8125 |
| -2.5 |
1.1875 |
| -1.5 |
0.1875 |
| -0.5 |
0.6875 |
| 0.5 |
-0.8125 |
| 1.5 |
1.1875 |
| 2.5 |
0.1875 |
| 3.5 |
-0.8125 |
|
|
| (x - mean x)² |
(x - mean x)*(y - mean y) |
| 12.25 |
6.34375 |
| 6.25 |
-2.96875 |
| 2.25 |
-0.28125 |
| 0.25 |
-0.34375 |
| 0.25 |
-0.40625 |
| 2.25 |
1.78125 |
| 6.25 |
0.46875 |
| 12.25 |
-2.84375 |
| SSx (sum of above) |
SPxy (sum of above) |
| 42 |
1.75 |
|
|
SSx is the sum of the squares of the differences between
each x (year) value and the mean of x (1977.5 in this case).
SSxy is the sum of the products of the differences between each x (year) value
and the mean of x, AND each y (count) value and the mean of y. |
|
|
|
Step 4: Determine the slope and y-intercept of
the regression equation.
| Slope |
SPxy divided by SSx |
1.75 / 42 |
0.0416666666667 |
| y-intercept |
mean count minus (slope*mean year) |
2.8125 - (0.0416666666667 * 1977.5) |
-79.5833333334 |
|
|
|
|
Linear regression equation: y = 0.0416666666667x + -79.5833333334 |
(where x is year and y is count) |
|
|
|
| Step 5: predicted y
values (plug x's into regression equation) |
|
Step 6: residuals
(actual y - predicted y) |
|
| predicted y value |
actual y value |
| 2.66666666667 |
1.0 |
| 2.70833333333 |
4.0 |
| 2.75 |
3.0 |
| 2.79166666667 |
3.5 |
| 2.83333333333 |
2.0 |
| 2.875 |
4.0 |
| 2.91666666667 |
3.0 |
| 2.95833333333 |
2.0 |
|
|
| Residuals |
| -1.66666666667 |
| 1.29166666667 |
| 0.250000000001 |
| 0.708333333334 |
| -0.833333333333 |
| 1.125 |
| 0.083333333334 |
| -0.958333333333 |
|
|
|
|
|
Step 7: Determine SD* (standard deviation) of the
residuals, and CV (coefficient of variation)
| SD of the residuals |
square root of (sum of squares divided by n-1) |
7.89583333335 / 2.64575131106 |
1.06206223475 |
| CV of the residuals |
SD of the residuals divided by count mean |
1.06206223475 / 2.8125 |
0.377622127911 |
*Normally the SD is calculated by getting the mean of the values
and subtracting each value from the mean, then squaring each of those
differences, and summing them (then dividing by n-1, and taking the
square root of the whole thing). But since residuals by definition
add up to zero, it is not necessary to calculate the mean, which would
also be zero, and subtract values from it.
|
|
|
|
|