This note will provide a set of answers to the various labs. The answers provided here will be relatively sparse, however. The idea is that you will have enough information to check whether more difficult steps are correctly taken - e.g. I will tell you the resulting number - but it avoids providing answers and interpretations that require you to think about the results. What I want to avoid is that you revert to the answer sheet before sufficiently trying yourself to come up with the answers, which is problematic from a pedagogical point of view.

Lab 1

##    Count Proportion
## 0     42       0.33
## 1      3       0.02
## 2      3       0.02
## 3      1       0.01
## 4      1       0.01
## 5      4       0.03
## 6      8       0.06
## 7      3       0.02
## 8     20       0.16
## 9      9       0.07
## 10    33       0.26

You should obtain as mean: 5.3228346.

(Note that you might have an additional category called “NA”, which should have been coded as properly missing.)

##      military
## sdnew  0  1
##     1 51  2
##     2 29  2
##     3 24  8
##     4 18  6
##     5 10  6
##      military
## sdnew    0    1
##     1 0.33 0.01
##     2 0.19 0.01
##     3 0.15 0.05
##     4 0.12 0.04
##     5 0.06 0.04

Questions:

Most of those you should try to work out yourself and ask if you are unsure. There are 158 cases and 8 variables and the proportion of countries that are in civil war in this data set 0.0961538, but try to find this yourself.

Lab 2

After the recode you should have the following distribution:

## 
##    Low Medium   High   <NA> 
##    149    155    150     46

If you cannot work out the correct direction of the percentages in the cross-table, ask me. Generally the idea is that you want to keep the counts on the categories of the independent variable “fixed”; so, for each of the categories of the independent variable it should add up to 100%.

You should find the following mean, median, variance, and standard deviation, respectively:

## [1] 3092.511
## [1] 1994.5
## [1] 13181284
## [1] 3630.604

After the log transformation, you can evaluate whether it worked by seeing if you obtain the following mean and standard deviation, respectively, of the log-transformed population variable:

## [1] 7.515634
## [1] 1.076067

The histograms before and after transformation should look like this:

Lab 3