Research Question: How are part-time and full-time government employment related to part-time government payroll?

library(tidyverse)
## ── 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
gov_data <- read.csv("GOVSEMPTIMESERIES.GS00EMP01-2026-09-22T170141.csv")
gov_data$`Part.Time.Payroll..PT_PAY.` <- as.numeric(gsub(",", "", gov_data$`Part.Time.Payroll..PT_PAY.`))

gov_data$`Part.Time.Employment..PT_EMP.` <- as.numeric(gsub(",", "", gov_data$`Part.Time.Employment..PT_EMP.`))

gov_data$`Full.Time.Employment..FT_EMP.` <- as.numeric(gsub(",", "", gov_data$`Full.Time.Employment..FT_EMP.`))
payroll_model <- lm(`Part.Time.Payroll..PT_PAY.` ~ `Part.Time.Employment..PT_EMP.` + `Full.Time.Employment..FT_EMP.`, data = gov_data)

summary(payroll_model)
## 
## Call:
## lm(formula = Part.Time.Payroll..PT_PAY. ~ Part.Time.Employment..PT_EMP. + 
##     Full.Time.Employment..FT_EMP., data = gov_data)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -472561885    -603608     206099     332698  536793227 
## 
## Coefficients:
##                                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                   -3.327e+05  6.167e+05  -0.539     0.59    
## Part.Time.Employment..PT_EMP.  1.720e+03  1.488e+01 115.584   <2e-16 ***
## Full.Time.Employment..FT_EMP.  4.152e+01  4.654e+00   8.920   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 27240000 on 1973 degrees of freedom
## Multiple R-squared:  0.9893, Adjusted R-squared:  0.9893 
## F-statistic: 9.119e+04 on 2 and 1973 DF,  p-value: < 2.2e-16

The adjusted R-squared is 0.9893, meaning the model explains approximately 98.93% of the variation in part-time payroll. Both part-time employment and full-time employment are statistically significant predictors because their p-values are below 0.001. Holding full-time employment constant, one additional part-time employee is associated with approximately 1,720 additional payroll units. Holding part-time employment constant, one additional full-time employee is associated with approximately 41.52 additional payroll units. The intercept is not statistically significant because its p-value is 0.59.

plot(payroll_model, which = 1)

The residuals-versus-fitted plot suggests that my model may violate the linearity assumption. The red line slopes downward rather than remaining approximately horizontal, and several observations are far from the main cluster of points. This suggests that the model may not fit all observations equally well. Therefore, the plot indicates a possible violation of the linearity assumption.