Psychology as a Science
The standard normal distribution
Transformations
Centering
Scaling
The z-transform
Making comparisons
Comparing groups
Comparing across groups
Making comparisons with the sampling distribution
If we measured the height of 1000 women and plotted the values then we might get something like Figure 1.
Most heights are in the 155–175 centimetre range.
The distribution is roughly symmetrical around its mean (165 cm) and it has a shape characteristic of a normal distribution.
Of course the plot in Figure 1 doesn’t look exactly like a normal distribution
But if we measured more and more people (e.g., 100, 000 people) then we might get something like Figure 2
Figure 2 also shows the corresponding normal distribution with a mean of 165 and a standard deviation of 10
Although the normal distribution is an idealisation, or an abstraction, we can use it to do some very useful things
In lecture 8, I said that two parameters, \(\mu\) and \(\sigma\) changed where the normal distribution was centred and how spread out it was
When \(\mu = 0\) and \(\sigma = 1\), then this distribution is called the standard normal distribution
I said that changing these values didn’t change the relative position of points on the plot. The overall shape remains the same
All normal distributions have the same overall shape as the standard normal distribution even if they’re centered in a different place and are more or less spread out
To see what I mean by this, we’ll take out heights of 1000 people, but instead of displaying them in centimetres we’ll display them in metres
Changing the scale on which you’re measured doesn’t actually change your height relative to other people
The distribution in Figure 3 (a) has a standard deviation of 10
The distribution in Figure 3 (b) has a standard deviation of 0.1.
But as you can see, they’re the same distributions—they’re just displayed on different scales (centimetres versus metres).
Changing the scale changes the standard deviation. This is why the standard deviation is sometimes referred to as the scale parameter for the distribution.
The fact that the relative positions of points don’t change is a useful property.
For the standard normal distribution, ~68% of the distribution falls between -1 and +1.
Put into relative terms this is ±1 \(\sigma\) from \(\mu\).
normal_plot_output = Plot.plot({
x: {
grid: true,
domain: [-4, 4]
},
y: {
grid: true,
domain: [0, 0.8]
},
marks: [
Plot.line(
normal_plot(
mean_value - sd_value * s > -4 ? mean_value - sd_value * s : -4,
mean_value + sd_value * s < 4 ? mean_value + sd_value * s : 4,
mean_value,
sd_value
),
{
x: "x",
y: "y",
strokeWidth: 1,
fill: "blue",
opacity: true ? 0.5 : 0
}
),
Plot.line(fill_limits(s), {
x: "x",
y: "y",
fill: "blue",
strokeWidth: 1,
opacity: true ? 0.5 : 0
}),
Plot.line(normal_plot(-4, 4, mean_value, sd_value), {
x: "x",
y: "y",
strokeWidth: 4
}),
Plot.ruleY([0])
]
})
In Figure 3 and Figure 4 we saw that we could transform a variable so that it had a new location (mean) or scale (standard deviation) without changing the shape
These two kinds of transformations are known as centering and **scaling*
To centre a set of measurements, you subtract a fixed value from each observation in the dataset.
This has the effect of shifting the distribution of the variable along the x-axis
You can technically centre a variable by subtracting any value from it but the most frequently used method is mean-centring
This is shown in Equation 1, below:
\[x_i - \bar{x} \qquad(1)\]
Mean centering a variable shifts it so that the new mean is at the zero point
The individual values of a mean-centred variable tell us how far that observation is from the mean of the entire set of measures
It doesn’t alter the shape of the distribution, or change the scale that it’s measured on
It only changes the interpretation of the values to, for example, differences from the mean
Scaling is performed by dividing each observation by some fixed value
This has the effect of stretching or compressing the variable along the x-axis
You can scale a variable by dividing it by any value
But typically scaling is done by dividing values by the standard deviation of the dataset.
This is shown in Equation 2, below:
\[\frac{x_i}{s} \qquad(2)\]
Scaling doesn’t change the fundamental shape of the variable’s distribution
But after scaling the data by the standard deviation the values would now be measured in units of sd
The formula for this is shown in Equation 3, below:
\[z(x) = \frac{x_i - \bar{x}}{s} \qquad(3)\]
The 10 values in Table 1 have a mean of 5.7 and a standard deviation of 2.21.
To ztransform the data in Table 1. We would do the following steps:
We’d subtract 5.7 from each value and put them in the Centred column
Then we’d divide each value in Centred by 2.21
The z transform will come in handy when it comes to making comparisons
Raw values | Centred | Scaled |
---|---|---|
4 | -1.7 | -0.77 |
6 | 0.3 | 0.14 |
6 | 0.3 | 0.14 |
9 | 3.3 | 1.49 |
1 | -4.7 | -2.12 |
7 | 1.3 | 0.59 |
5 | -0.7 | -0.32 |
8 | 2.3 | 1.04 |
5 | -0.7 | -0.32 |
6 | 0.3 | 0.14 |
In the context of quantitative research we’re often looking at the average difference in a variable between groups
In the Figure 5 we can see measurements from a reaction time task.
Amateurs sportspeople have a mean reaction time of 500 ms and professionals have a mean reaction time of 460 ms.
There is overlap between the two groups, but there is a difference between the averages
To quantify the difference, just subtract the mean of one group from the mean of the other1
In the previous example the comparisons were easy because the measurements were on the same scale (milliseconds)
But let’s say that you want to compare two children on a puzzle completion task
One child is 8 years old, and the other is 14 years old
They do slightly different versions of the task and the tasks are score differently
Because we have two different tests that might have a different number of items etc we can’t just compare the raw numbers to see which is bigger
Let’s look at an example…
Let’s take two children:
Ahorangi is 8 years old and scored 86 on the task
Benjamin is 14 years old and scored 124 on the task
We can easily tell that Benjamin’s score is higher than Ahorangi’s score
But the scores are not directly comparable…so what do we do?
We have to look at how each performed relative to their age groups.
Is Ahorangi better performing relative to 8-year-olds than Benjamin is relative to 14-year-olds?
To answer this question we can use the z-transform
To do the z-transform we need to know the mean and standard deviation for each age group
Age group | Mean | Standard deviation |
---|---|---|
8-year-olds | 80 | 2 |
14-year-olds | 120 | 8 |
We can calculate Ahorangi’s z-score as follows:
\[3 = \frac{86 - 80}{2}\]
And for Benjamin:
\[0.5 = \frac{124 - 120}{8}\]
That means, that Ahorangi, despite having a lower score, actually scored very high for an 8-year-old. Benjamin, on the other hand, only scored a little higher than the average 14-year-old.
The final comparison we’ll talk about is comparisons against the sampling distribution
From last week we learned that the sampling distribution of the mean will be
Centred at the population mean
Have a standard deviation equal to the standard error of the mean
But remember, we don’t know the value of the population mean, so we won’t actually know what the sampling distribution looks like
Although we don’t know the value of the population mean we can generate a hypothesis about what we think the population mean might be…
We can then generate a hypothetical sampling distribution based on our hypothesised value of the population mean
I’ll make it concrete with an example:
Let’s say I get a group of people to perform a task where they have to try and quickly recognise two sets of faces. Either famous faces or faces of their family members.
I find that the mean difference between these two conditions is 24.87ms
But this is just the difference in my sample. The population mean difference might be some other value
Although we don’t know the population mean, we could hypothesise that it is 100 ms, 50 ms, 0 ms, or some other value. Let’s just pick 0 ms for now.
Now we can generate a sampling distribution using our hypothesised population mean and the standard error of the mean we estimate from the sample (let’s say it’s 8.88)
In Figure 6 we can see what the sampling distribution would look like if the population mean were 0.
We can compare our particular sample mean of 24.87ms to the sampling distribution
Because the sampling distribution is a normal distribution we know that ~68% of the time the sample means will fall between ±1 SEM of the population mean (-8.88ms to 8.88ms)
And ~95% of the time sample means will fall between -17.76ms and 17.76ms.
For our particular mean we see that it falls 2.8 SEM from our hypothesised population mean
What can we make of this?
We can conclude that if the population mean were in fact 0 then we have observed something rare
If the population mean were in fact 0, then it would be rare for a sample mean to be that far away from the population mean
Observing something rare doesn’t tell us that our hypothesis is wrong
Rare things happen all the time!
This process of comparing our sample to the sampling distribution is known as null hypothesis significance testing
And it will be a major topic that you’ll cover next year.
sd_value_slider = Inputs.range([0.5, 2], {
value: 1,
step: 0.25,
label: htl.html`standard deviation <br />σ`
})
mean_value_slider = Inputs.range([-3, 3], {
value: 0,
step: 0.25,
label: htl.html`mean<br /> μ`
})
// jStat.normal.pdf( x, mean, std )
normal_plot = (min, max, mean, sd) => {
// jStat.normal.pdf(x, mean, sd)
return d3.ticks(min, max, 501).map((v) => {
return {
x: v,
y: dnorm(v, mean, sd)
};
});
}
skew_normal_plot = (min, max, alpha) => {
// jStat.normal.pdf(x, mean, sd)
return d3.ticks(min, max, 201).map((v) => {
return {
x: v,
y: dsn(v, alpha)
};
});
}
dsn = (x, alpha) => {
// set the defaults
const xi = 0;
const omega = 1;
const tau = 0;
let z = (x - xi) / omega;
let logN = -Math.log(Math.sqrt(2 * Math.PI)) - 0 - Math.pow(z, 2) / 2;
let logS = Math.log(
jStat.normal.cdf(tau * Math.sqrt(1 + Math.pow(alpha, 2)) + alpha * z, 0, 1)
);
let logPDF = logN + logS - Math.log(jStat.normal.cdf(tau, 0, 1));
return Math.exp(logPDF);
}
kurtosis = {
return {
uniform: -(6 / 5),
raised_cosine: (6 * (90 - Math.PI ** 4)) / (5 * (Math.PI ** 2 - 6) ** 2),
standard_normal: 0,
t_dist30: 6 / (30 - 4),
t_dist20: 6 / (20 - 4),
t_dist10: 6 / (10 - 4),
t_dist7: 6 / (7 - 5),
t_dist5: 6 / (5 - 4)
};
}
dists = {
return {
raised_cosine: d3.ticks(-3, 3, 500).map((v) => {
return {
x: v,
y: dist.raised_cosine(v, 0, 2.5)
};
}),
standard_normal: d3.ticks(-3, 3, 500).map((v) => {
return {
x: v,
y: dnorm(v, 0, 1)
};
}),
t_dist30: d3.ticks(-3, 3, 500).map((v) => {
return {
x: v,
y: dist.dt(v, 30)
};
}),
t_dist20: d3.ticks(-3, 3, 500).map((v) => {
return {
x: v,
y: dist.dt(v, 20)
};
}),
t_dist10: d3.ticks(-3, 3, 500).map((v) => {
return {
x: v,
y: dist.dt(v, 10)
};
}),
t_dist7: d3.ticks(-3, 3, 500).map((v) => {
return {
x: v,
y: dist.dt(v, 7)
};
}),
t_dist5: d3.ticks(-3, 3, 500).map((v) => {
return {
x: v,
y: dist.dt(v, 5)
};
}),
uniform: d3.ticks(-2.1, 2.1, 500).map((v) => {
return {
x: v,
y: dist.dunif(v, -2, 2)
};
})
};
}
fill_limits = (mult) => {
let s = sd_value * mult;
return [
{ x: mean_value - s > -4 ? mean_value - s : -4, y: 0 },
normal_plot(
mean_value - s > -4 ? mean_value - s : -4,
mean_value - s > -4 ? mean_value - s : -4,
mean_value,
sd_value
)[0],
normal_plot(
mean_value + s < 4 ? mean_value + s : 4,
mean_value + s < 4 ? mean_value + s : 4,
mean_value,
sd_value
)[0],
{ x: mean_value + s < 4 ? mean_value + s : 4, y: 0 }
];
}