Title: Self test: Correlation and regression
Course: UGQuants (SSPS) > Section: Correlation and Regression

Week 5 - Exercise 1

This is the first of eleven exercises in this self test.

Open the WDI 2011 dataset and do the following.

1. Locate the variables that describe the proportion of a country's labour force engaged in agriculture lfagr, and the proportion which live in cities, urbpop. Produce a scatterplot of these two variables, placing lfagr on the X axis (can you see why?). Satisfy yourself that the relationship between the two variables is approximately linear.

Using the computer...

- Calculate the Pearson correlation coefficient for the two variables.
- Produce the regression equation for the two variables.
- Report how much of the variation in urbanisation in a country can be accounted for by the variation in agricultural work in a country (the coefficient of determination r squared).
- Predict the degree of urbanisation in a country where
a)   10% of the workforces is in agriculture
b)   half the workforce is in agriculture
c)   80% of the workforces is in agriculture

Exercise 1: Answer

r = -0.696
% urban pop = 80.23 + (-0.869 * % employment in agriculture)
r squared = 0.485
80.23 + (-0.869 * 10)
= 80.23 - 8.69
= 71.54

80.23 + (-0.869 * 50)
= 36.78

80.23 + (-0.869 * 80)
=10.71

Exercise 2

Locate the variables for fertility (number of children per woman) and infant mortality (deaths per 1000 live births).

Produce a scattergram and satisfy yourself that the relationship between these variables is approximately linear.

Using SPSS

- Calculate the Pearson correlation coefficient, and
- Produce the regression equation for these variables, treating fertility as the independent variable.
- How much of the variation in infant mortality is accounted for by variation in fertility?
- Estimate the infant mortality rate, to the nearest whole number, in a country where the fertility rate is:
a)   10
b)   5
c)   2
d)   1.
- How would you interpret your last result?

Exercise 2: Answer

The variables for fertility (number of children per woman) and infant mortality (deaths per 1000 live births) are fertility and mort_inf.
Your scattergram should look something like this:

The Pearson correlation coefficient is 0.850
The regression equation: Deaths per 1000 live births = -15.51 + 14.81 * fertility rate

72.3% of the variation in infant mortality is explained by the fertility rate.

Infant mortality rate, to the nearest whole number, in a country where the fertility rate is:
10: -15.51 + 14.81 * 10 = 132.59
5: -15.51 + 14.81 * 5 = 58.54
2: -15.51 + 14.81 * 2 = 14.11
1: -15.51 + 14.81 * 1 = -0.7
How would you interpret the last result?
There is only one country in the dataset with such a low fertility rate, so that such a value is virtually outwith the range of our observations. It may well be the case that at low values for fertility, the relationship is no longer linear.

Exercise 3

Locate the variables for gdp per head and for fertility (total births per woman).

Produce a scattergram, treating gdp per head as the predictor variable and satisfy yourself that the relationship between these variables is not linear. Transform the gdp variable by logging it (Hint: use the formula LN in the SPSS compute dialog box).

Using SPSS

1. Calculate the Pearson correlation coefficient between your transformed gdp per head variable and fertility, and
2. Produce the regression equation for these variables, treating fertility as the dependent variable.
3. How much of the variation in fertility is accounted for by variation in gdp?
4. Estimate the infant mortality rate for a county with GDP per head of
  - 1000$
  - 3000$
  - 30000$.
[Hint: to find the natural log of 1,000 3,000 and 30,000 use a calculator, a spreadsheet such as 'excel' or use SPSS. If you want to use SPSS, create a new dataset by opening a new data editor window. Input the numbers 1,000 3,000 and 30,000 as values taken by three cases for this variable. Then compute a new variable equal to the natural log of this variable using the 'compute' command. You will then have the natural logs of your original values in the column for your new variable in the data editor window.]

Exercise 3: Answer

Your scattergram should look something like this:

The Pearson correlation coefficient between transformed gdp per head variable and fertility = 0.743.
The regression equation for the variables, with female life expectancy as the dependent variable: Fertility = 8.36 + (-0.695 *ln_gdp)
55.2% of the variation in fertility is accounted for by variation in gdp.

For a country with GDP her head of 1000$ our estimate would be:
Fertility = 8.36 + (-0.695 * ln 1,000) = 3.56

For a country with GDP her head of 3000$ our estimate would be:
Fertility = 2.80

For a country with GDP her head of 30000$ our estimate would be:
Fertility = 1.20

Exercise 4

What is the Pearson correlation coefficient between…

1. Female life expectancy and the incidence of HIV;
2. Fertility and female adult literacy;
3. Female life expectancy and female adult literacy;
4. Female life expectancy and gdp?

Exercise 4: Answer

Female life expectancy and the incidence of HIV= -0.560
Female fertility and female adult literacy = -0.780
Female life expectancy and female adult literacy = +0.696
Female life expectancy and gdp = +0.583

Exercise 5

The formula for a regression line is...

- Y = aX + b + ε
Feedback: Incorrect.
- X = A + bX
Feedback: Incorrect.
- X = bY + A + ε
Feedback: Incorrect.
- Y = a + bX + ε
Feedback: Correct!
- D = F+ R + ε
Feedback: Incorrect.

Exercise 6

We can use linear regression to examine the form of a relationship when...

(tick all boxes that apply)

- both our variables are interval level
Feedback: Correct! All four answers are correct.
- both our variables are continuous
Feedback: Correct! All four answers are correct.
- when the distribution of data points in our scatterplot approximates a straight line
Feedback: Correct! All four answers are correct.
- when we are interested only in the range of values for which we have observations
Feedback: Correct! All four answers are correct.

Exercise 7

The intercept in a regression line is the point where...

(tick all boxes that apply)

- the regression line crosses the X axis
Feedback: Incorrect.
- the regression line crosses the Y axis
Feedback: Correct! There are 2 correct answers. Click the return button if you have not found the other yet.
- the value for Y when X equals 0 on the regression line
Feedback: Correct! There are 2 correct answers. Click the return button if you have not found the other yet.
- the end point of the regression line
Feedback: Incorrect.
- the midpoint of the regression line
Feedback: Incorrect.

Exercise 8

The gradient in a regression line is...

(tick all boxes that apply)

- its slope
Feedback: Correct! There are four correct answers. Click the return button if you have not found all of them yet.
- flat if there is no relationship between the variables
Feedback: Correct! There are four correct answers. Click the return button if you have not found all of them yet.
- upwards if the correlation is positive
Feedback: Correct! There are four correct answers. Click the return button if you have not found all of them yet.
- the value of b in the regression equation
Feedback: Correct! There are four correct answers. Click the return button if you have not found all of them yet.
- the value of x in the equation
Feedback: Incorrect.

Exercise 9

Variance is...

- a) r squared
Feedback: Incorrect
- b) the sum of the squared distances from the mean of each of the values a variable takes for a set of cases, divded by the number of cases minus one
Feedback: Read the response options carefully!
- c) the total sum of residuals
Feedback: Incorrect.
- d) the sum of squared residuals, divided by the number of cases minus one
Feedback: Read the response options carefully!
- e) both (b) and (d)
Feedback: Correct!

Exercise 10

The Pearson Correlation coefficient...

- a) is represented by the letter R
Feedback: Read the response options carefully!
- b) varies from -1 to +1
Feedback: Read the response options carefully!
- c) can be used only for interval level variables
Feedback: Read the response options carefully!
- d) all the above are true
Feedback: Correct!
- e) only b and c are true
Feedback: Incorrect.

Exercise 11

Correlation is...

- a necessary but not sufficient condition of causation
Feedback: Correct!
- a sufficient but not necessary condition of causation
Feedback: Incorrect.
- evidence of the direction of cause and effect
Feedback: Incorrect.
- a situation where r=1
Feedback: Incorrect.
- equal to the slope of the regression line
Feedback: Incorrect.