Intuition for confidence intervals vs prediction intervals for linear regression I am having a bit of trouble understanding the difference between a confidence and prediction interval in the context of linear regression, and in what scenario we would use either of them. I've posed a scenario below to show what my current understanding is, can anyone confirm my thinking is correct? If not, can you explain the difference between them and when we would use either?
'Imagine we’re running a study on the IQ scores of children between the ages of 1 and 10. We are doing a simple linear model using only their age as a regressor. Say we’ve studied ‘3 children aged 1, 10 children aged 2, 14 children aged 4 (note I have explicitly skipped children aged 3 for this example) and so on and so forth’. Two new children are to be tested: one who is aged 2 and the other who is aged 3. If I wanted to find their IQ score based on their age would I do it like this:
We already have data about children aged 2, so I would be interested in the confidence interval for the expected mean response, when predicting this childs IQ.
Then, for the other child who is aged 3 (an age we haven’t recorded any data for), here, I would use a prediction interval instead of a confidence interval, because I have no data to work with for children aged 3.'

A confidence interval is for the mean of a group of people who have the same input values for your X. If all assumptions are met, 95% of the confidence intervals you calculate will contain the true group mean.
However, you know, and a linear regression model explicitly states, that individuals drawn from this population won't all have the same value, even if they have the same X's. You expect variation from individual to individual. So if you want to have 95% confidence for individual predictions, you need a wider confidence interval.
That is why there are two different names. A "Confidence Interval" is for the expected value of a group. A "Prediction Interval" is for an individual.
So, for your example, it does not matter* whether you have existing data on children aged 3 or not. If you want an interval for their individual scores, use a prediction interval. If you want an interval for the mean of a group of children who are age 3, use a confidence interval.
"Does not matter" only applies to the question of whether you select a prediction or a confidence interval. You should only predict on the range of your data, so extrapolating to 10-year-olds, for example, would be risky because you are essentially assuming that the change in IQ has the same shape for all ages, and you don't have data to check.
