Project 2 - Smoking

Author

Esuka Haluwana

Image: keckmedicine.org

Project Overview

This project explores how daily smoking rates changed for males and females from 1980 to 2012. I chose this topic because a single smoking rate can hide differences between groups. I included Sri Lanka because of my Sri Lankan background, and I use India and the United States as two other countries for comparison.

Research Questions

  1. How did daily smoking rates change in India, Sri Lanka, and the United States from 1980 to 2012?

  2. How did daily cigarette consumption per smoker vary across countries in 1980, 1996, and 2012?

Data Overview

The estimates originally came from the Institute for Health Metrics and Evaluation (IHME) and are available through the CORGIS Dataset Project. The file contains 6,204 observations and 9 variables. Each observation represents one location in one year. The file covers 187 countries and includes a separate World total for each year from 1980 through 2012.

Country is the categorical variable. The eight quantitative variables are year, average cigarettes smoked per smoker per day, three smoking rates, and three smoker counts. The rates and counts are reported for males, females, and both groups combined. Smoking rates measure the percentage of people who smoke daily, while smoker counts estimate how many people smoke daily.

Source: https://corgis-edu.github.io/corgis/csv/smoking/

1. Loading the Data

library(tidyverse)
Warning: package 'ggplot2' was built under R version 4.6.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.1     ✔ readr     2.2.0
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.3     ✔ tibble    3.3.1
✔ lubridate 1.9.5     ✔ tidyr     1.3.2
✔ purrr     1.2.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
smoking <- readr::read_csv("https://corgis-edu.github.io/corgis/datasets/csv/smoking/smoking.csv")
Rows: 6204 Columns: 9
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): Country
dbl (8): Year, Data.Daily cigarettes, Data.Percentage.Male, Data.Percentage....

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

2. Exploring the Dataset

Before making the graphs, I check the dataset’s size, columns, year range, missing values, and repeated records.

# Check the dataset size, column names, and years.
dim(smoking)
[1] 6204    9
names(smoking)
[1] "Country"                "Year"                   "Data.Daily cigarettes" 
[4] "Data.Percentage.Male"   "Data.Percentage.Female" "Data.Percentage.Total" 
[7] "Data.Smokers.Total"     "Data.Smokers.Female"    "Data.Smokers.Male"     
summary(smoking$Year)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   1980    1988    1996    1996    2004    2012 
# Count missing values and check for repeated location-year records.
colSums(is.na(smoking))
               Country                   Year  Data.Daily cigarettes 
                     0                      0                      0 
  Data.Percentage.Male Data.Percentage.Female  Data.Percentage.Total 
                     0                      0                      0 
    Data.Smokers.Total    Data.Smokers.Female      Data.Smokers.Male 
                     0                      0                      0 
smoking %>%
  count(Country, Year) %>%
  filter(n > 1)
# A tibble: 0 × 3
# ℹ 3 variables: Country <chr>, Year <dbl>, n <int>

3. Preparing the Data

The three prevalence columns in CORGIS are mislabeled. Comparing the records with the original data distributed by Our World in Data showed that Male contains the overall rate, Female contains the male rate, and Total contains the female rate. I use the corrected labels and separate the World rows from the country rows.

# Give the prevalence columns names that match their values.
smoking_clean <- smoking %>%
  mutate(
    prevalence_total = Data.Percentage.Male,
    prevalence_male = Data.Percentage.Female,
    prevalence_female = Data.Percentage.Total,
    cigarettes_per_day = `Data.Daily cigarettes`
  )

# Keep country estimates and worldwide estimates separate.
smoking_countries <- smoking_clean %>% filter(Country != "World")
smoking_world <- smoking_clean %>% filter(Country == "World")

4. Comparing Smoking Rates in Three Countries

A line chart shows how the percentage of daily smokers changed over time in each country.

# Select the three countries for the comparison.
selected_countries <- smoking_countries %>%
  filter(Country %in% c("India", "Sri Lanka", "United States"))

# Draw one line per country using the corrected overall smoking rate.
ggplot(selected_countries, aes(x = Year, y = prevalence_total, color = Country)) +
  geom_line() +
  scale_color_manual(values = c(
    "India" = "#0072B2",
    "Sri Lanka" = "#009E73",
    "United States" = "#D55E00"
  )) +
  theme_bw() +
  labs(
    title = "Daily Smoking Rates in Three Countries",
    x = "Year",
    y = "Age-standardized daily smoking rate (%)",
    color = "Country",
    caption = "Source: IHME via Our World in Data and CORGIS"
  )

From 1980 to 2012, the smoking rate fell from 29.7% to 15.3% in the United States, from 17.6% to 12.6% in India, and from 13.4% to 12.0% in Sri Lanka. The United States had the largest drop, at 14.4 percentage points. India’s rate fell even though its estimated number of daily smokers increased from about 74.5 million to 110.2 million.

5. Comparing Worldwide Smoker Counts

I use the World estimates already in the dataset. I convert the counts to millions and use pivot_longer() to put the overall, male, and female counts on the same graph.

# Convert the counts to millions and arrange them for the graph.
world_counts <- smoking_world %>%
  mutate(
    Overall = Data.Smokers.Total / 1000000,
    Male = Data.Smokers.Male / 1000000,
    Female = Data.Smokers.Female / 1000000
  ) %>%
  select(Year, Overall, Male, Female) %>%
  pivot_longer(
    c(Overall, Male, Female),
    names_to = "series",
    values_to = "smokers_millions"
  )

# Draw a line for each worldwide count.
ggplot(world_counts, aes(x = Year, y = smokers_millions, color = series)) +
  geom_line() +
  scale_color_manual(values = c(
    Overall = "#404040",
    Male = "#0072B2",
    Female = "#CC79A7"
  )) +
  theme_bw() +
  labs(
    title = "Estimated Number of Daily Smokers Worldwide",
    x = "Year",
    y = "Daily smokers (millions)",
    color = "Count series",
    caption = "Source: IHME via Our World in Data and CORGIS"
  )

The worldwide count increased from about 721 million in 1980 to 967 million in 2012. The male count rose from about 572 million to 807 million, while the female count rose from about 149 million to 160 million. Over the same period, the worldwide smoking rate fell from 25.1% to 18.6%. The number of smokers can rise while the smoking rate falls because the count also depends on population size and age structure.

6. Comparing Cigarette Consumption Across Countries

The box plots compare country averages in the first, middle, and last years of the dataset. Each country contributes one value per year.

# Keep three years and treat each year as a separate group.
consumption_years <- smoking_countries %>%
  filter(Year %in% c(1980, 1996, 2012)) %>%
  mutate(year_group = factor(Year))

# Find the median country estimate for each selected year.
consumption_years %>%
  group_by(Year) %>%
  summarise(median_cigarettes = median(cigarettes_per_day))
# A tibble: 3 × 2
   Year median_cigarettes
  <dbl>             <dbl>
1  1980              20.9
2  1996              18.4
3  2012              17.4
# Compare country averages with one box plot per year.
ggplot(consumption_years,
       aes(x = year_group, y = cigarettes_per_day, fill = year_group)) +
  geom_boxplot() +
  scale_fill_manual(values = c(
    "1980" = "#D55E00",
    "1996" = "#0072B2",
    "2012" = "#009E73"
  )) +
  theme_bw() +
  labs(
    title = "Daily Cigarette Consumption Across Countries",
    x = "Year",
    y = "Average cigarettes per smoker per day",
    fill = "Year",
    caption = "Source: IHME via Our World in Data and CORGIS; World total excluded"
  )

The median country estimate fell from 20.9 cigarettes per smoker per day in 1980 to 18.4 in 1996 and 17.4 in 2012. The boxes overlap, so the lower median does not mean cigarette consumption fell in every country.

Conclusion

Smoking rates fell in all three countries I compared, while the estimated number of daily smokers worldwide increased. The median amount of cigarettes smoked per smoker decreased too. The comparison of these two amounts of information has provided me with an insight on measures of the population smoking percentage and measures of smoking prevalence. Once I obtained the data, I needed to order it. I made sure that the information is complete and no duplicate information occurs in the list. All I needed to do was to make sure to use correct names for all the columns in the table and identify further work required to be done with the data. Additionally, I kept world data separate to avoid misrepresentation of information about countries smoking rates in the boxplots. The estimates regarding cigarette consumption were very high, but I had no information to conclude on them being error in data received. It would be interesting to add uncertainty intervals for the graphs represented in this part of the work.

Citations

Data Source: Institute for Health Metrics and Evaluation (IHME). Smoking prevalence and cigarette consumption estimates, 1980–2012. Available through the https://corgis-edu.github.io/corgis/csv/smoking/?utm_source=chatgpt.com. The Our World in Data version was used to verify the smoking rate labels.

Original Study: Ng M, et al. (2014). Smoking Prevalence and Cigarette Consumption in 187 Countries, 1980–2012. JAMA. https://doi.org/10.1001/jama.2013.284692

Image Source: Kiwiev (2005). Cigarette in ashtray. Wikimedia Commons, CC0.

R Packages Used: