The Stata code I used is below:
use
"C:\File Location\ESS6e02.dta", clear
rename idno id
rename cntry c
rename stflife
ls
rename ppltrst t
drop if ls >
10 | t > 10 | age == 999 | c == "IS"
keep id c ls t
*Collapsing the
variables by country will automatically convert trust and life-satisfaction
scores into their country averages
collapse t ls,
by(c)
*Average GDP per
capita in $ over 2009-13 taken from World Bank
http://data.worldbank.org/indicator/NY.GDP.PCAP.CD
gen gdppc = 4652
if c == "AL"
replace gdppc =
45387 if c == "BE"
replace gdppc =
7296 if c == "BG"
replace gdppc =
80477 if c == "CH"
replace gdppc =
25249 if c == "CY"
replace gdppc =
18861 if c == "CZ"
replace gdppc =
45085 if c == "DE"
replace gdppc =
58894 if c == "DK"
replace gdppc =
18478 if c == "EE"
replace gdppc =
29118 if c == "ES"
replace gdppc =
47219 if c == "FI"
replace gdppc =
41421 if c == "FR"
replace gdppc =
39337 if c == "GB"
replace gdppc =
13134 if c == "HU"
replace gdppc =
47400 if c == "IE"
replace gdppc =
36151 if c == "IL"
replace gdppc =
34619 if c == "IT"
replace gdppc =
15538 if c == "LT"
replace gdppc =
47617 if c == "NL"
replace gdppc =
100819 if c == "NO"
replace gdppc =
13432 if c == "PL"
replace gdppc =
21035 if c == "PT"
replace gdppc =
14612 if c == "RU"
replace gdppc =
58269 if c == "SE"
replace gdppc =
22729 if c == "SI"
replace gdppc =
17689 if c == "SK"
replace gdppc =
3900 if c == "UA"
replace gdppc =
3816 if c == "XK"
gen lngdppc =
ln(gdppc)
*Inverted
Legatum Prosperity "Europe only" rankings where 1 = lowest, 27 =
highest, taken from http://www.prosperity.com/
gen legatumrank
= 1 if c == "AL"
replace
legatumrank = 18 if c == "BE"
replace
legatumrank = 4 if c == "BG"
replace
legatumrank = 26 if c == "CH"
replace
legatumrank = 9 if c == "CY"
replace
legatumrank = 13 if c == "CZ"
replace
legatumrank = 20 if c == "DE"
replace
legatumrank = 24 if c == "DK"
replace
legatumrank = 10 if c == "EE"
replace
legatumrank = 16 if c == "ES"
replace
legatumrank = 23 if c == "FI"
replace
legatumrank = 17 if c == "FR"
replace
legatumrank = 19 if c == "GB"
replace
legatumrank = 6 if c == "HU"
replace
legatumrank = 21 if c == "IE"
replace
legatumrank = 7 if c == "IL"
replace
legatumrank = 12 if c == "IT"
replace
legatumrank = 5 if c == "LT"
replace
legatumrank = 22 if c == "NL"
replace
legatumrank = 27 if c == "NO"
replace
legatumrank = 11 if c == "PL"
replace
legatumrank = 14 if c == "PT"
replace
legatumrank = 3 if c == "RU"
replace
legatumrank = 25 if c == "SE"
replace
legatumrank = 15 if c == "SI"
replace
legatumrank = 8 if c == "SK"
replace
legatumrank = 2 if c == "UA"
*Life expectancy
from WHO http://en.wikipedia.org/wiki/List_of_countries_by_life_expectancy
gen lifeexp = 74
if c == "AL"
replace lifeexp
= 81 if c == "BE"
replace lifeexp
= 74.5 if c == "BG"
replace lifeexp
= 82.8 if c == "CH"
replace lifeexp
= 81.2 if c == "CY"
replace lifeexp
= 78 if c == "CZ"
replace lifeexp
= 81 if c == "DE"
replace lifeexp
= 79.5 if c == "DK"
replace lifeexp
= 76.1 if c == "EE"
replace lifeexp
= 82.5 if c == "ES"
replace lifeexp
= 79.6 if c == "FI"
replace lifeexp
= 82.3 if c == "FR"
replace lifeexp
= 81 if c == "GB"
replace lifeexp
= 75 if c == "HU"
replace lifeexp
= 81.4 if c == "IE"
replace lifeexp
= 82.1 if c == "IL"
replace lifeexp
= 83.1 if c == "IT"
replace lifeexp =
75.9 if c == "LT"
replace lifeexp
= 81.5 if c == "NL"
replace lifeexp
= 81.9 if c == "NO"
replace lifeexp
= 77.5 if c == "PL"
replace lifeexp
= 80 if c == "PT"
replace lifeexp
= 70.5 if c == "RU"
replace lifeexp
= 83 if c == "SE"
replace lifeexp
= 80 if c == "SI"
replace lifeexp
= 77 if c == "SK"
replace lifeexp
= 71 if c == "UA"
pwcorr ls t
lngdp legatum lifeexp, sig
scatter ls
legatum, mlabel(c) || lfit ls legatum
scatter ls
lngdppc, mlabel(c) || lfit ls lngdppc
scatter ls t,
mlabel(c) || lfit ls t
scatter ls
lifeexp, mlabel(c) || lfit ls lifeexp