Load in data and packages below
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.2 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.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
library(ggthemes)
library(ggrepel)
library(effsize)
library(ggplot2)
library(reshape2)
##
## Attaching package: 'reshape2'
##
## The following object is masked from 'package:tidyr':
##
## smiths
cdata <- read.csv("/Users/cadgo/Downloads/data_aging_congress.csv")
cdf <- data.frame(cdata)
finalcdf <- cdf |>
group_by(bioguide_id) |>
mutate(years_in_congress_at_start = cmltv_cong*2 - 2,
total_terms_in_congress = max(cmltv_cong),
total_years_in_congress = total_terms_in_congress*2,
before_2000 = floor(congress/107),
incumbent = ifelse(cmltv_cong > 1, 1, 0))
The underlying issue I wanted to tackle with my data is to look at the problem of an aging congress. Many Americans today are complaining about the fact that Washington D.C. is filled with politicians who should be in retirement homes instead of in office.
I wanted to look at the data to see if the complaints are valid, and if the age of Congress is really trending towards an older population.
Shown below is a sample of the data set I will be using for this analysis.
head(finalcdf)
## # A tibble: 6 × 18
## # Groups: bioguide_id [2]
## congress start_date chamber state_abbrev party_code bioname bioguide_id
## <int> <chr> <chr> <chr> <int> <chr> <chr>
## 1 82 1951-01-03 House ND 200 AANDAHL, Fred… A000001
## 2 80 1947-01-03 House VA 100 ABBITT, Watki… A000002
## 3 81 1949-01-03 House VA 100 ABBITT, Watki… A000002
## 4 82 1951-01-03 House VA 100 ABBITT, Watki… A000002
## 5 83 1953-01-03 House VA 100 ABBITT, Watki… A000002
## 6 84 1955-01-03 House VA 100 ABBITT, Watki… A000002
## # ℹ 11 more variables: birthday <chr>, cmltv_cong <int>, cmltv_chamber <int>,
## # age_days <int>, age_years <dbl>, generation <chr>,
## # years_in_congress_at_start <dbl>, total_terms_in_congress <int>,
## # total_years_in_congress <dbl>, before_2000 <dbl>, incumbent <dbl>
As you can see above, the columns of the data include the congress number, the age of the congressperson in days, the age in years, their birthday, the generation they are a part of, the years of experience they have, the cumulative terms in congress, their bio id, their name, their party code, the start date for the congress, the state they represent, and the chamber they served in.
For the sake of the analysis, we will just be focusing on the congress ID number, the chamber, the party code ID, the age in years, and the binary column “Before_2000” which represents if the term was served before or after the year 2000.
The code below will just show the general trend of the average age in Congress, without any filters.
conage <- cdf |>
group_by(congress) |>
summarise(avg_age = mean(age_years))
conage |>
ggplot(aes(congress, avg_age)) +
geom_point(color = 'grey') +
geom_smooth( color = 'blue', se = FALSE) +
labs(title = "Average Age of Congress over Time",
x = "Congress ID",
y = "Average Age") +
theme_classic()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
model1 <- lm(age_years ~ congress, data = finalcdf)
summary(model1)
##
## Call:
## lm(formula = age_years ~ congress, data = finalcdf)
##
## Residuals:
## Min 1Q Median 3Q Max
## -30.430 -7.842 -0.242 7.437 43.070
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 45.96449 0.38094 120.66 <2e-16 ***
## congress 0.08454 0.00409 20.67 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 10.69 on 29118 degrees of freedom
## Multiple R-squared: 0.01446, Adjusted R-squared: 0.01443
## F-statistic: 427.4 on 1 and 29118 DF, p-value: < 2.2e-16
As we can see from the above graph, in recent years, the age of Congress has been the oldest it has ever been. The last congress that was recorded in the data was Congress 118, where the average age was 58.55 years old. For context, the average age of the American population was 38.4 years old.
We can also see that in the linear model, the age has increased on average by .1 years every congress, dating back to when the data started in 1947.
To confirm the findings, I will conduct a hypothesis test. The hypothesis I will be testing will be the following: The average age of Congress after the year 2000 is equal to the average age of Congress before 2000.
n1 <- finalcdf |>
group_by(before_2000) |>
summarize(sd = sd(age_years),
mean = mean(age_years))
odiff <- (n1$mean[2] -
n1$mean[1])
paste("Observed Difference in means: ", odiff)
## [1] "Observed Difference in means: 4.8004513715938"
Yes, there are factors that impact who serves in Congress, including minimum age requirements, which justifies why the average age of a congress member is much older than the population. It isn’t feasible to put children into Congress to make decisions for America. But the issue lies with the age increasing more than the average age increase of the population each congress.
If we create a graph to show if there is a political party that is to blame for the shift, we can see there isn’t a significant difference between the two major parties.
party_ages <- finalcdf[finalcdf$party_code %in% c('100','200'),]
party_ages1 <- party_ages |>
group_by(congress, party_code) |>
summarise(mean_age = mean(age_years))
## `summarise()` has grouped output by 'congress'. You can override using the
## `.groups` argument.
party_ages1$party_code<-as.character(party_ages1$party_code)
party_ages1 |>
ggplot(aes(congress, mean_age)) +
geom_point(aes(colour = party_code)) +
geom_smooth(aes(colour = party_code), se = FALSE) +
scale_colour_manual(values=c("blue", "red")) +
labs(title = "The Average Age of Democrats vs Republicans",
subtitle = "Blue represents Democrats, Red represents Republicans",
x = "Congress ID",
y = "Age") +
theme_classic()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
We can see that the Democrats in office have grown older than their republican peers, which is a trend that has been swapped over time.
Of course, each Congress member ages while they are in Congress, so they will be older for each term they serve, but the age of new members of Congress varies from year to year. The code and graph below should show that.
new_members <- cdf |>
filter(cmltv_cong == 1) |>
group_by(congress) |>
summarise(avg_age = mean(age_years))
new_members |>
ggplot(aes(congress, avg_age)) +
geom_point(color = 'gray') +
geom_line(color = 'gray') +
geom_smooth(method = 'lm', color='blue', se = FALSE) +
labs(title = "Average Age of New Members of Congress over Time.",
x = "Congress ID",
y = "Average Age") +
theme_classic()
## `geom_smooth()` using formula = 'y ~ x'
As we can see, the average age of new members of congress hasn’t increased as significantly as the overall trend, so what’s the deal?
Below, I will create a graph of the Incumbent members’ average age over time to see if their trend can explain anything.
old_members <- cdf |>
filter(cmltv_cong > 1) |>
group_by(congress) |>
summarise(avg_age = mean(age_years))
old_members |>
ggplot(aes(congress, avg_age)) +
geom_point(color = 'gray') +
geom_line(color = 'gray') +
geom_smooth(method = 'lm', color='blue', se = FALSE) +
labs(title = "Average Age of Incumbent Members of Congress over Time.",
x = "Congress ID",
y = "Average Age") +
theme_classic()
## `geom_smooth()` using formula = 'y ~ x'
Let’s create a graph to get a better comparison.
in_ages <- finalcdf |>
group_by(congress, incumbent) |>
summarise(mean_age = mean(age_years))
## `summarise()` has grouped output by 'congress'. You can override using the
## `.groups` argument.
in_ages$incumbent <-as.character(in_ages$incumbent)
in_ages |>
ggplot(aes(congress, mean_age)) +
geom_point(aes(colour = incumbent)) +
geom_smooth(aes(colour = incumbent), se = FALSE) +
scale_colour_manual(values=c("skyblue", "orange")) +
labs(title = "The Average Age of Incumbents vs New Members",
subtitle = "Blue represents New Members, Orange represents Incumbents",
x = "Congress ID",
y = "Age") +
theme_classic()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
In the graph above, we can see a more clear trend towards an older congress in recent years among the incumbents. This raises the question, are voting trends heading towards keeping more incumbents in office?
We will look to answer this question using the code below and graph below.
new_or_incumbent <- cdf |>
group_by(congress) |>
summarise(incumbents = sum(cmltv_cong > 1, na.rm=TRUE),
new_members = sum(cmltv_cong == 1))
new_or_incumbent <- melt(new_or_incumbent, id.vars = 'congress', variable.name = 'count')
new_or_incumbent |>
ggplot(aes(congress, value)) +
geom_point(aes(colour = count)) +
geom_smooth(aes(colour = count), method = 'lm', se = FALSE) +
scale_colour_manual(values=c("orange", "skyblue")) +
labs(title = "Incumbent vs New Members in Each Congress",
x = "Congress ID",
y = "Count") +
theme_classic()
## `geom_smooth()` using formula = 'y ~ x'
The above graph shows us that there is a growing trend of more incumbents staying in office and fewer new members joining Congress. This can be a factor in the trend where Congress is getting older each year, and that it is simply growing older with the people that are still present in it.
We can see that the average age of incumbents is significantly higher than the new members, and having fewer of them replaced in Congress means there are fewer people to help bring down the average.
We know that with current voting trends, it is getting increasingly harder to enter Congress as a new member as voters tend to vote for the incumbent. This can be backed by data that is not found within the scope of this project.
A Congress whose age is significantly older than the average American population can fail to take actions that affect younger Americans positively. The aging population is more out of touch with the interests of the American people and can lead to issues in the future if policies are not made to benefit the younger generations. This aging population is caused by an increasing pattern of voters voting for incumbents, keeping older congresspeople in service for longer.