# Resources

## Excel walk-throughs

- Part 1.1 Drawing a line chart of temperature and time
- Part 1.1 Plotting a line chart and adding a horizontal line
- Part 1.2 Creating a frequency table
- Part 1.2 Calculating percentiles
- Part 1.2 Using Excel’s COUNTIF function
- Part 1.2 Calculating and understanding the variance
- Part 1.3 Calculating correlation and drawing a scatterplot
- Part 2.1 Reformatting a table
- Part 2.1 Drawing a line chart with multiple variables
- Part 2.2 Drawing a column chart to compare two groups
- Part 2.2 Calculating the standard deviation
- Part 2.2 Finding the minimum, maximum, and range of a variable
- Part 2.3 Using Excel’s T.TEST function
- Part 3.1 Making a frequency table using Excel’s PivotTable option
- Part 3.1 Making a pivot table with more than two variables
- Part 3.1 Making a column chart to compare two groups
- Part 4.1 Making a frequency table
- Part 4.1 Adding data labels to a chart
- Part 4.2 Calculating the HDI
- Part 4.2 Ranking data
- Part 5.1 Creating a table showing cumulative shares
- Part 5.1 Drawing the perfect equality line
- Part 5.2 Drawing a column chart with sorted values
- Part 6.1 Using Excel’s IF function
- Part 6.1 Overlaying one column chart over another
- Part 6.1 Drawing box and whisker plots
- Part 6.2 Creating confidence intervals and adding them to a chart
- Part 6.3 Using Excel’s IF function
- Part 8.1 Cleaning data and splitting variables
- Part 8.1 Dropping observations that satisfy particular conditions
- Part 8.1 Calculating percentiles from actual values
- Part 9.2 Creating and formatting time variables
- Part 12.2 Using SUBSTITUTE to clean text in cells

## R walk-throughs

- Getting started in R: Installing R and RStudio
- Getting started in R: RStudio orientation
- Part 1.1 Importing the datafile into R
- Part 1.1 Drawing a line chart of temperature and time
- Part 1.1 Producing a line chart for the annual temperature anomalies
- Part 1.2 Creating frequency tables and histograms
- Part 1.2 Using the
`quantile`

function - Part 1.2 Using the
`mean`

function - Part 1.2 Calculating and understanding mean and variance
- Part 1.3 Scatterplots and the correlation coefficient
- Part 2.1Plotting a line chart with multiple variables
- Part 2.2 Importing the datafile into R
- Part 2.2 Calculating the mean using a loop or the
`apply`

function - Part 2.2 Drawing a column chart to compare two groups
- Part 2.2 Calculating and understanding the standard deviation
- Part 2.2 Finding the minimum, maximum, and range of a variable
- Part 2.2 Creating a table of summary statistics
- Part 2.3 Calculating the p-value for the difference in means
- Part 3.1 Importing the datafile into R
- Part 3.1 Counting the number of unique elements in a variable
- Part 3.1 Creating frequency tables
- Part 3.1 Calculating conditional means
- Part 3.1 Making a column chart to compare two groups
- Part 3.1 Calculating the p-value for price changes
- Part 3.2 Importing data from a Stata file and plotting a line chart
- Part 4.1 Importing the Excel file (
`.xlsx`

or`.xls`

format) into R - Part 4.1 Making a frequency table
- Part 4.1 Creating new variables
- Part 4.1 Plotting and annotating time series data
- Part 4.1 Calculating new variables and plotting time series data
- Part 4.1 Creating stacked bar charts
- Part 4.2 Calculating the HDI
- Part 4.2 Creating your own HDI
- Part 5.1 Importing an Excel file (either
`.xlsx`

or .`xls`

format) into R - Part 5.1 Calculating cumulative shares using the
`cumsum`

function - Part 5.1 Drawing Lorenz curves
- Part 5.1 Calculating Gini coefficients
- Part 5.1 Calculating Gini coefficients for all countries and all years using a loop
- Part 5.1 Plotting time series of Gini coefficients, using ggplot
- Part 5.2 Importing
`.csv`

files into R - Part 5.2 Creating line graphs with
`ggplot`

- Part 5.2 Drawing a column chart with sorted values
- Part 5.2 Drawing a column chart with sorted values
- Part 5.2 Using line and bar charts to illustrate changes in time
- Part 6.1 Importing data into R and creating tables and charts
- Part 6.1 Obtaining frequency counts and plotting overlapping histograms
- Part 6.1 Creating box and whisker plots
- Part 6.2 Calculating confidence intervals and adding them to a chart
- Part 6.3 Calculating and adding conditional summary statistics and confidence intervals to a chart
- Part 7.1 Importing data into R and creating tables and charts
- Part 8.1 Importing the data into R
- Part 8.1 Cleaning data and splitting variables
- Part 8.1 Dropping specific observations
- Part 8.1 Calculating averages and percentiles
- Part 8.1 Calculating summary statistics
- Part 8.2 Calculating frequencies and percentages
- Part 8.2 Plotting multiple lines on a chart
- Part 8.2 Creating dummy variables and calculating correlation coefficients
- Part 8.2 Calculating group means
- Part 8.3 Calculating confidence intervals and adding error bars
- Part 9.1 Importing data into R
- Part 9.1 Creating summary tables
- Part 9.1 Making frequency tables for loan applications and outcomes
- Part 9.1 Creating variables to classify households
- Part 9.1 Making frequency tables to compare proportions
- Part 9.1 Calculating differences in household characteristics
- Part 9.1 Calculating confidence intervals and adding them to a chart
- Part 9.1 Calculating conditional means
- Part 9.2 Data cleaning and summarizing loan characteristics
- Part 9.2 Making summary tables and calculating correlations
- Part 9.2 Creating summary tables of means
- Part 10.1 Importing an Excel spreadsheet into R
- Part 10.1 Making box and whisker plots
- Part 10.1 Tabulating and visualizing time trends
- Part 10.1 Creating weighted averages
- Part 10.1 Dealing with extreme values
- Part 10.2 Calculating confidence intervals
- Part 10.2 Plotting column charts with error bars
- Part 11.1 Importing data and recoding variables
- Part 11.1 Creating indices
- Part 11.1 Calculating correlation coefficients
- Part 11.1 Using loops to obtain summary statistics
- Part 11.1 Calculating summary statistics
- Part 11.2 Summarizing willingness to pay variables
- Part 11.2 Summarizing Dichotomous Choice (DC) variables
- Part 11.2 Calculating confidence intervals for differences in means
- Part 12.1 Importing a specified range of data from a spreadsheet
- Part 12.1 Calculating cumulative income shares and plotting a Lorenz curve
- Part 12.1 Generating Gini coefficients
- Part 12.1 Converting nominal incomes to real incomes
- Part 12.2 Importing data directly from a website
- Part 12.2 Cleaning imported data
- Part 12.2 Cleaning data and setting dates

## Google Sheets walk-throughs

- Part 1.1 Drawing a line chart of temperature and time
- Part 1.1 Plotting a line chart and adding a horizontal line
- Part 1.2 Creating a frequency table
- Part 1.2 Calculating percentiles
- Part 1.2 Using Google Sheets’ COUNTIF function
- Part 1.2 Calculating and understanding the variance
- Part 1.3 Calculating correlation and drawing a scatterplot
- Part 2.1Reformatting a table
- Part 2.1Drawing a line chart with multiple variables
- Part 2.2 Drawing a column chart to compare two groups
- Part 2.2 Calculating the standard deviation
- Part 2.2 Finding the minimum, maximum, and range of a variable
- Part 2.3 Calculating and interpreting the p-value
- Part 3.1 Making a frequency table using the PivotTable option
- Part 3.1 Making a pivot table with more than two variables
- Part 3.1 Making a column chart to compare two groups
- Part 4.1 Making a frequency table
- Part 4.1 Adding data labels to a chart
- Part 4.2 Calculating the HDI
- Part 4.2 Ranking data
- Part 5.1 Creating a table showing cumulative shares
- Part 5.1 Drawing the perfect equality line
- Part 5.2 Drawing a column chart with sorted values
- Part 6.1 Using the IF function
- Part 6.1 Overlaying one column chart over another
- Part 6.1 Drawing box and whisker plots
- Part 6.2 Creating confidence intervals and adding them to a chart
- Part 6.3 Using the IF function
- Part 8.1 Cleaning data and splitting variables
- Part 8.1 Dropping observations that satisfy particular conditions
- Part 8.1 Calculating percentiles from actual values
- Part 9.2 Creating and formatting time variables
- Part 12.2 Using SUBSTITUTE to clean text in cells

## Solution figures

### Empirical Project 1

**Solution figure 1.1**: An example of a line chart with average temperature anomaly for January on the vertical axis and time (1880–2016) on the horizontal axis.**Solution figure 1.2**: A line chart showing average temperature anomaly for spring.**Solution figure 1.3**: A line chart showing average temperature anomaly for summer.**Solution figure 1.4**: A line chart showing average temperature anomaly for autumn.**Solution figure 1.5**: A line chart showing average temperature anomaly for winter.**Solution figure 1.6**: A line chart with annual average temperature anomaly on the vertical axis and time (1880–2016) on the horizontal axis.**Figure 1.4**: Northern hemisphere temperatures over the long run (1000–2006).**Solution figure 1.7**: A frequency table for 1951–1980.**Solution figure 1.8**: A frequency table for 1981–2010.**Solution figure 1.9**: A column chart for 1951–1980.**Solution figure 1.10**: A column chart for 1981–2010.**Solution figure 1.11**: Mean and variance per season for periods 1921–1950, 1951–1980, and 1981–2010.**Solution figure 1.12**: Trend and interpolated monthly mean CO_{2}(mole fraction).**Solution figure 1.13**: Scatterplot CO_{2}vs temperature (June).**Solution figure 1.14**: A scatterplot showing CO_{2}levels and temperature anomaly for January.**Solution figure 1.15**: A scatterplot showing CO_{2}levels and temperature anomaly for December.

### Empirical Project 2

**Solution figure 2.1**: Average contribution over time.**Solution figure 2.2**: Mean contributions by period, with and without punishment.**Solution figure 2.3**: Comparison of mean contributions over time.**Solution figure 2.4**: Average contributions in Periods 1 and 10, with and without punishment.**Solution figure 2.5**: Standard deviations in both experiments.**Solution figure 2.6**: Minimum and maximum values for both experiments.**Solution figure 2.7**: Summary tables for contributions in both experiments.**Solution figure 2.8**: Example data from two coin-toss experiments.

### Empirical Project 3

**Solution figure 3.1**: Frequency table: All stores in December 2014 and June 2015.**Solution figure 3.2**: Numbers of taxed and untaxed beverages by store type, December 2014.**Solution figure 3.3**: Numbers of taxed and untaxed beverages by store type, June 2015.**Solution figure 3.4**: Product types available, December 2014 and June 2015.**Solution figure 3.5**: Average price per ounce of taxed and non-taxed beverages, by time period and store type.**Solution figure 3.6**: Change in the mean price per oz ounce for taxed and non-taxed beverages, by store type.**Solution figure 3.7**: Mean change in price per oz for taxed and non-taxed beverages, by store type.**Solution figure 3.8**: Average prices of taxed and non-taxed beverages in Berkeley vs non-Berkeley stores.**Solution figure 3.9**: Average prices of taxed and non-taxed beverages in Berkeley vs non-Berkeley stores.

### Empirical Project 4

**Solution figure 4.1**: Number of years of GDP data available for each country (1970–2016).**Solution figure 4.2**: The US’s GDP components (expenditure approach), 1970–2016.**Solution figure 4.3**: China’s GDP components (expenditure approach), 1970–2016.**Solution figure 4.4**: China’s GDP components (expenditure approach), with annotations (1970–2016).**Solution figure 4.5**: Share of components of GDP in China (1970–2016).**Solution figure 4.6**: Share of components of GDP in the US (1970–2016).**Solution figure 4.7**: Share of each component of GDP for a selection of countries in 2015.**Solution figure 4.8**: Composition of GDP in 2015.**Solution figure 4.9**: Minimum and maximum values of the chosen indicators.**Solution figure 4.10**: Comparing alternative HDI rank and HDI rank.**Solution figure 4.11**: Scatterplot of GDP per capita rank and HDI rank.**Solution figure 4.12**: Comparison of countries according to GDP per capita and HDI.

### Empirical Project 5

**Solution figure 5.1**: Table showing cumulative income shares for China (1980).**Solution figure 5.2**: Table showing cumulative income shares for China (2014).**Solution figure 5.3**: Table showing cumulative income shares for the US (1980).**Solution figure 5.4**: Table showing cumulative income shares for the US (2014).**Solution figure 5.5**: Lorenz curves for China.**Solution figure 5.6**: Lorenz curves for the US.**Solution figure 5.7**: Lorenz curves for China, with labelled Gini coefficients.**Solution figure 5.8**: Lorenz curves for the US, with labelled Gini coefficients.**Solution figure 5.9**: Mortality inequality Gini coefficients (1952–2002).**Solution figure 5.10**: Countries ranked according to mortality inequality Gini coefficients in 1952.**Solution figure 5.11**: Countries ranked according to mortality inequality Gini coefficients in 2002.**Solution figure 5.12**: Median availability of selected generic medicines in the private sector (2007–2013).**Solution figure 5.13**: Median availability of selected generic medicines in the public sector (2007–2013).**Solution figure 5.14**: Female pupils as a percentage of total enrolment in primary education (1980–2010).**Solution figure 5.15**: Change (%) in female pupils’ share of total enrolment in primary education (1980–2010).

### Empirical Project 6

**Solution figure 6.1**: Mean of management scores.**Solution figure 6.2**: Rank according to management scores.**Solution figure 6.3**: Management practices in manufacturing firms around the world.**Solution figure 6.4**: Frequency tables for the US and Chile.**Solution figure 6.5**: Comparing the distribution of management scores for the US and Chile.**Solution figure 6.6**: Box and whisker plots for the US and Chile.**Solution figure 6.7**: Mean scores for hospitals.**Solution figure 6.8**: Mean scores for schools.**Solution figure 6.9**: Bar chart of mean management score for hospitals.**Solution figure 6.10**: Bar chart of mean management score for schools.**Solution figure 6.11**: Mean management score in manufacturing firms for the US and Chile.**Solution figure 6.12**: Bar chart of mean management score in manufacturing firms for the US and Chile, with 95% confidence intervals.**Solution figure 6.13**: Mean management score and 95% confidence interval width for hospitals and schools.**Solution figure 6.14**: Bar chart of mean management score for hospitals, with 95% confidence intervals.**Solution figure 6.15**: Bar chart of mean management score for schools, with 95% confidence intervals.**Solution figure 6.16**: Mean management score and 95% confidence interval width for private and public hospitals.**Solution figure 6.17**: Mean management score and 95% confidence interval width for private and public schools.**Solution figure 6.18**: Bar chart of mean management score for public and private hospitals, with 95% confidence intervals.**Solution figure 6.19**: Bar chart of mean management score for public and private schools, with 95% confidence intervals.**Solution figure 6.20**: Table of mean management score and 95% confidence interval width, according to ownership type.**Solution figure 6.21**: Brazil: Bar chart of mean management score by ownership type, with 95% confidence intervals.**Solution figure 6.22**: Canada: Bar chart of mean management score by ownership type, with 95% confidence intervals.**Solution figure 6.23**: US: Bar chart of mean management score by ownership type, with 95% confidence intervals.

### Empirical Project 7

**Solution figure 7.1**: Prices and quantities of watermelons (values rounded to two decimal places).**Solution figure 7.2**: Price of watermelons (USD per 1,000, 1931–1950).**Solution figure 7.3**: Quantity of watermelons planted (millions, 1931–1950).**Solution figure 7.4**: Calculated prices and quantities (in natural logs and actual values).**Solution figure 7.5**: Supply and demand diagram.**Solution figure 7.6**: New supply after the shock.**Solution figure 7.7**: Supply and demand after a negative supply shock.

### Empirical Project 8

**Solution figure 8.1**: Completed data dictionary.**Solution figure 8.2**: Self-reported employment status in each country (per cent of sample).**Solution figure 8.3**: A summary table for the EVS data.**Solution figure 8.4**: Frequency table for work ethic (Germany, Wave 3).**Solution figure 8.5**: Frequency table for work ethic (Germany, Wave 4).**Solution figure 8.6**: Distribution of work ethic score in Germany: Waves 3 and 4.**Solution figure 8.7**: Average life satisfaction across countries and survey waves.**Solution figure 8.8**: Line chart of average life satisfaction (wellbeing) across countries and survey waves.**Solution figure 8.9**: Correlation between life satisfaction, work ethic and other variables.**Solution figure 8.10**: Average life satisfaction according to employment status and country.**Solution figure 8.11**: Difference in average life satisfaction: full-time employed minus unemployed, and full-time employed minus retired.**Solution figure 8.12**: Difference in life satisfaction between the full-time employed and the unemployed vs average work ethic.**Solution figure 8.13**: Difference in life satisfaction between the full-time employed and the retired vs average work ethic.**Solution figure 8.14**: Summary table of life satisfaction, by employment status.**Solution figure 8.15**: Calculated values for differences in life satisfaction (full-time vs retired).**Solution figure 8.16**: Calculated values for differences in life satisfaction (full-time vs unemployed).**Solution figure 8.17**: Calculated width of 95% confidence interval for differences in life satisfaction (full-time vs retired).**Solution figure 8.18**: Calculated width of 95% confidence interval for differences in life satisfaction (full-time vs unemployed).**Solution figure 8.19**: Difference in life satisfaction (wellbeing): full-time and retired.**Solution figure 8.20**: Difference in life satisfaction (wellbeing): full-time and unemployed.

### Empirical Project 9

**Solution figure 9.1**: Proportion of sample living in towns vs rural areas, by ‘region’. (Note that numbers may not add up to 1 due to rounding.)**Solution figure 9.2**: Summary table for household demographics (all households).**Solution figure 9.3**: Loan applications and approvals.**Solution figure 9.4**: Most important reason for not applying for a loan.**Solution figure 9.5**: Second most important reason for not applying for a loan.**Solution figure 9.6**: Loan purpose for successful and denied (credit-excluded) borrowers.**Solution figure 9.7**: Comparison of household characteristics (successful and denied borrowers).**Solution figure 9.8**: Comparison of household characteristics, conditioning on the ‘rural’ variable.**Solution figure 9.9**: Calculating 95% confidence interval for difference in means between ‘successful’ and ‘denied’ borrowers.**Solution figure 9.10**: Difference in means between ‘successful’ and ‘denied’ borrowers by household characteristics, with 95% confidence intervals.**Solution figure 9.11**: Comparison of household characteristics by borrower type.**Solution figure 9.12**: Summary measures of loan amount (principal) and total amount.**Solution figure 9.13**: Loan amounts and interest rates.**Solution figure 9.14**: Comparison of distribution of long-term and short-term loans.**Solution figure 9.15**: Correlations between interest rate and household characteristics.**Solution figure 9.16**: Source of loan, by variable ‘rural’.**Solution figure 9.17**: Source of loan, by variable ‘rural’ (‘Other’ category only).**Solution figure 9.18**: Duration of loan (rounded to nearest day).**Solution figure 9.19**: Loan amount (rounded to nearest whole number).**Solution figure 9.20**: Interest rate (rounded to two decimal places).**Solution figure 9.21**: Proportion of households with a female head, according to source of finance.

### Empirical Project 10

**Solution figure 10.1**: Box and whisker plot: Private credit by deposit money banks to GDP (%).**Solution figure 10.2**: Box and whisker plot: Deposit money banks’ assets to GDP (%).**Solution figure 10.3**: Box and whisker plot: Bank accounts per 1,000 adults.**Solution figure 10.4**: Box and whisker plot: Bank branches per 100,000 adults.**Solution figure 10.5**: Box and whisker plot: Firms with a bank loan or line of credit (%).**Solution figure 10.6**: Box and whisker plot: Small firms with a bank loan or line of credit (%).**Solution figure 10.7**: Box and whisker plot: Bank Z-score.**Solution figure 10.8**: Box and whisker plot: Bank regulatory capital to risk-weighted assets (%).**Solution figure 10.9**: Deposit money banks’ assets to GDP (%), 2000–2014, by income group.**Solution figure 10.10**: Deposit money banks’ assets to GDP (%), 2000–2014, by region.**Solution figure 10.11**: Bank accounts per 1,000 adults, 2000–2014, by income group.**Solution figure 10.12**: Bank accounts per 1,000 adults, 2000–2014, by region.**Solution figure 10.13**: Deposit money banks’ assets to GDP (%), 2000–2014, by income group.**Solution figure 10.14**: Deposit money banks’ assets to GDP (%), 2000–2014, by region.**Solution figure 10.15**: Bank accounts per 1,000 adults, 2000–2014, by income group.**Solution figure 10.16**: Bank accounts per 1,000 adults, 2000–2014, by region.**Solution figure 10.17**: Population-weighted averages of the indicator ‘Bank accounts per 1,000 adults’, 2004–2014.**Solution figure 10.18**: Bank accounts per 1,000 adults: Winsorized averages for 2010.**Solution figure 10.19**: Bank Z-score, by income group.**Solution figure 10.20**: Capital to asset ratio, by income group.**Solution figure 10.21**: Bank Z-score, by region.**Solution figure 10.22**: Capital to asset ratio, by region.**Solution figure 10.23**: Confidence intervals for Bank Z-score, by income group.**Solution figure 10.24**: Confidence intervals for Capital to asset ratio, by income group.**Solution figure 10.25**: Confidence intervals for Bank Z-score, by region.**Solution figure 10.26**: Confidence intervals for Capital to asset ratio, by region.

### Empirical Project 11

**Solution figure 11.1**: Correlation table for survey items on climate change scepticism: Climate change is exaggerated (exaggeration), Human activity is not the main cause of climate change (not.human.activity), No evidence of global warming (no.evidence).**Solution figure 11.2**: Correlation table for survey items on government intervention: the government interferes too much (too.much), governments should not pass laws so that people can act to their own advantage (not.pass.laws), governments should intervene as little as possible in economic matters (minimal.intervention), governments should stop dictating to people how they should live (not.dictate), the government should not do more to achieve social goals even if it restricts individual freedom (indiv.freedom), individuals should have more personal responsibility (personal.responsibility).**Solution figure 11.3**: Correlation table for survey items on ‘personal responsibility for the environment’: I buy locally to reduce emissions (buy.local), I am obliged to take impact of daily activities on climate (individual.impact), I feel better when reducing emissions (feel.better), I prefer to use public transport (public.transport), I feel uncomfortable when consuming energy (conserve.energy), I try to reduce emissions as much as possible (reduce.emissions).**Solution figure 11.4**: Gender of participants, by group.**Solution figure 11.5**: Age of participants, by group.**Solution figure 11.6**: Highest educational attainment, by group.**Solution figure 11.7**: Number of children, by group.**Solution figure 11.8**: Environmental organization membership, by group.**Solution figure 11.9**: Household net income per month in euros, by group.**Solution figure 11.10**: Summary table for ‘climate change beliefs’ index.**Solution figure 11.11**: Summary table for ‘preferences for government intervention’ index.**Solution figure 11.12**: Summary table for ‘personal responsibility for the environment’ index.**Solution figure 11.13**: Column charts of minimum WTP.**Solution figure 11.14**: Column charts of maximum WTP.**Solution figure 11.15**: Correlation table of average WTP and other variables.**Solution figure 11.16**: DC format: Responses for each amount.**Solution figure 11.17**: DC format: Reponses (in percentages), with ‘abstain’ counted as ‘no’.**Solution figure 11.18**: ‘Demand curve’ from DC respondents.**Solution figure 11.19**: DC format: Responses (in percentages), with ‘abstain’ responses excluded.**Solution figure 11.20**: ‘Demand curve’ from DC respondents, under different treatments for ‘abstain’ responses.**Solution figure 11.21**: Summary table for WTP.

### Empirical Project 12

**Solution figure 12.1**: 15th percentile of incomes.**Solution figure 12.2**: 25th percentile of incomes.**Solution figure 12.3**: 50th percentile of incomes.**Solution figure 12.4**: 75th percentile of incomes.**Solution figure 12.5**: 85th percentile of incomes.**Solution figure 12.6**: Cumulative share of income, for some percentiles of the population.**Solution figure 12.7**: Lorenz curves for 2011 and 2012.**Solution figure 12.8**: Incomes earned by each percentile of the population.**Solution figure 12.9**: Creating an index-based series from percentage increases.**Solution figure 12.10**: Overall satisfaction with the government (2006–2017).**Solution figure 12.11**: Satisfaction with government’s improvement of people’s prosperity (2006–2017).