PSY 348: Lecture 4
Farmingdale State College
\(x\)
\(\color{#B5483B}{\bar{x}}\)
\(\color{#3E6E8E}{\sum(x)}\)
\(\color{#A0527A}{x^2}\) NEW
\(x\) = refers to the value for 1 person (1 datapoint) in the sample
\(\color{#B5483B}{\bar{x}}\) = refers to the mean or average value of X in the sample
\(\color{#3E6E8E}{\sum(x)}\) = refers to the sum of all x values (sum of all the datapoints)
\(\color{#A0527A}{x^2}\) = refers to the squared value of x (x multiplied by x) NEW
\(data = \{1,4,3,2,4,6\}\)
\(x\) = \(1 \mid 4 \mid 3 \mid 2 \mid 4 \mid 6\)
\(\color{#B5483B}{\bar{x}}\) = \(3.33\bar{3}\)
\(\color{#3E6E8E}{\sum(x)}\) = \(1 + 4 + 3 + 2 + 4 + 6 = 20\)
\(\color{#A0527A}{x^2}\) = \(1 \mid 16 \mid 9 \mid 4 \mid 16 \mid 36\) NEW
Spread
How much the participants’ responses differ from one another
Variance
Did participants give similar answers?
Did participants give wildly different answers?
Data should have natural dispersion.
If everyone gives a similar answer, it’s harder to analyze difference.
On average, how far is each x-value from the midpoint
Calculate how far each x-value is from the midpoint (mean)
Take the average of those distances.
In psychology, the mid-point we use will be the mean
| Sample Data | |
| X values for 10 participants | |
| Participant | X |
|---|---|
| 1 | 1 |
| 2 | 3 |
| 3 | 2 |
| 4 | 2 |
| 5 | 3 |
| 6 | 2 |
| 7 | 1 |
| 8 | 3 |
| 9 | 1 |
| 10 | 2 |
Step 2: Subtract the mean from each X-value.
\(x - \color{#B5483B}{\bar{x}}\)
\((1-2) + (3-2) + (2-2) + (2-2)...\)
\((-1) + 1 + 0 + 0...\)
| Deviation Scores | ||
| Each x value's distance from the mean | ||
| ParticipantID | x | \(x-\color{#B5483B}{\bar{x}}\) |
|---|---|---|
| 1 | 1 | -1 |
| 2 | 3 | 1 |
| 3 | 2 | 0 |
| 4 | 2 | 0 |
| 5 | 3 | 1 |
| 6 | 2 | 0 |
| 7 | 1 | -1 |
| 8 | 3 | 1 |
| 9 | 1 | -1 |
| 10 | 2 | 0 |
The average of the deviation scores will always = 0.
On average, the x-values = x.
So the average distance of x from x is 0.
The problem is the negative numbers!
How do we get rid of negative numbers?
\((x - \color{#B5483B}{\bar{x}}) = (1-2) = -1 \quad\rightarrow\quad (x-\color{#B5483B}{\bar{x}})^2 = (-1)^2 = 1\)
| Squared Deviations | |||
| Removing the negative signs | |||
| ParticipantID | x | \((x-\color{#B5483B}{\bar{x}})\) | \((x-\color{#B5483B}{\bar{x}})^2\) |
|---|---|---|---|
| 1 | 1 | -1 | 1 |
| 2 | 3 | 1 | 1 |
| 3 | 2 | 0 | 0 |
| 4 | 2 | 0 | 0 |
| 5 | 3 | 1 | 1 |
| 6 | 2 | 0 | 0 |
| 7 | 1 | -1 | 1 |
| 8 | 3 | 1 | 1 |
| 9 | 1 | -1 | 1 |
| 10 | 2 | 0 | 0 |
Step 1: Calculate the mean.
Step 2: Subtract the mean from each X-value.
Step 3: Square each deviation score.
Step 4: Add up the Squared Deviations.
\(1+1+0+1...\)
| Sum of Squared Deviations | |||
| ParticipantID | x | \((x-\color{#B5483B}{\bar{x}})\) | \((x-\color{#B5483B}{\bar{x}})^2\) |
|---|---|---|---|
| 1 | 1 | -1 | 1 |
| 2 | 3 | 1 | 1 |
| 3 | 2 | 0 | 0 |
| 4 | 2 | 0 | 0 |
| 5 | 3 | 1 | 1 |
| 6 | 2 | 0 | 0 |
| 7 | 1 | -1 | 1 |
| 8 | 3 | 1 | 1 |
| 9 | 1 | -1 | 1 |
| 10 | 2 | 0 | 0 |
Step 5: Divide by (n-1).
\(\dfrac{\color{#3E6E8E}{\sum} (x-\color{#B5483B}{\bar{x}})^2}{\color{#8A5A3C}{n}-1}\)
(n-1) is called the degrees of freedom – we use it here because we’re estimating the population’s variance from a sample, and dividing by a slightly smaller number corrects for that estimation.
When we squared the deviation scores in Step 3, we inflated the deviation.
We have to undo that inflation.
How do you undo squaring?
We take the square root.
| Why We Divide by n − 1 | ||||
| Correcting the inflation from squaring | ||||
| ParticipantID | X | \((x-\color{#B5483B}{\bar{x}})\) | \((x-\color{#B5483B}{\bar{x}})^2\) | |
|---|---|---|---|---|
| 1 | 40.55 | −2.79 | 7.782 | |
| 2 | 48.55 | 5.21 | 27.145 | |
| 3 | 46.751 | 3.411 | 11.636 | |
| 4 | 42.035 | −1.304 | 1.701 | |
| 5 | 45.682 | 2.342 | 5.485 | |
| 6 | 36.47 | −6.869 | 47.188 | |
| Sum | — | — | — | 100.93818 |
| Mean | — | — | — | 20.18764 |
Step 6: Take the square root.
\[ \Large{\sqrt{\dfrac{\color{#3E6E8E}{\sum}(x-\color{#B5483B}{\bar{x}})^2}{\color{#8A5A3C}{n}-1}}} \]
Tip
Tip
Variance
\[ \large{\color{#7A5C99}{s^2} = \frac{\color{#3E6E8E}{\sum}(x-\color{#B5483B}{\bar{x}})^2}{\color{#8A5A3C}{n}-1}} \]
Standard Deviation
\[ \large{\color{#5C715E}{s} = \sqrt{\frac{\color{#3E6E8E}{\sum}(x-\color{#B5483B}{\bar{x}})^2}{\color{#8A5A3C}{n}-1}}} \]
Variance is a measure of dispersion.
Standard deviation is a better measure of dispersion, because it is standardized.
Tip
Problem (do by hand first):
Compute the sample mean, each deviation from the mean, the sum of squared deviations, the sample variance, and the sample standard deviation for the dataset:
\(x = [4, 2, 5, 6, 3]\)
Tip
practice1.R
x <- c(4,2,5,6,3)
n <- length(x)
sum_x <- sum(x)
mean_x <- mean(x)
deviations <- x - mean_x
sq_dev <- deviations^2
ssd <- sum(sq_dev)
s2 <- var(x) # sample variance by default (n-1)
s <- sd(x)
list(
n = n,
sum = sum_x,
mean = mean_x,
deviations = deviations,
squared_deviations = sq_dev,
sum_squared_deviations = ssd,
sample_variance = s2,
sample_sd = s
)$n
[1] 5
$sum
[1] 20
$mean
[1] 4
$deviations
[1] 0 -2 1 2 -1
$squared_deviations
[1] 0 4 1 4 1
$sum_squared_deviations
[1] 10
$sample_variance
[1] 2.5
$sample_sd
[1] 1.581139
Tip
Two instructors have class scores:
Tip
Class A
Tip
Class B
Dispersion | ⬡⬢⬡⬢