This analysis examines relationships between government employment and payroll variables using 2025 government data. The goal is to identify correlations, visualize relationships, and investigate one relationship using an appropriate correlation method.
The cor() command was used to examine correlations among
full-time employment, full-time payroll, part-time employment, part-time
payroll, full-time equivalent employment, total employment, and total
payroll.
cor(gov_data[, c(5, 6, 7, 8, 10, 11, 12)],
use = "complete.obs")
## Full-Time Employment (FT_EMP)
## Full-Time Employment (FT_EMP) 1.0000000
## Full-Time Payroll (FT_PAY) 0.9957419
## Part-Time Employment (PT_EMP) 0.9568142
## Part-Time Payroll (PT_PAY) 0.9575117
## Full-Time Equivalent Employment (FTE) 0.9996222
## Total Full-Time and Part-Time Employment (TOT_EMP) 0.9975601
## Total Full-Time and Part-Time Payroll (TOT_PAY) 0.9953080
## Full-Time Payroll (FT_PAY)
## Full-Time Employment (FT_EMP) 0.9957419
## Full-Time Payroll (FT_PAY) 1.0000000
## Part-Time Employment (PT_EMP) 0.9600376
## Part-Time Payroll (PT_PAY) 0.9641246
## Full-Time Equivalent Employment (FTE) 0.9958675
## Total Full-Time and Part-Time Employment (TOT_EMP) 0.9950649
## Total Full-Time and Part-Time Payroll (TOT_PAY) 0.9997684
## Part-Time Employment (PT_EMP)
## Full-Time Employment (FT_EMP) 0.9568142
## Full-Time Payroll (FT_PAY) 0.9600376
## Part-Time Employment (PT_EMP) 1.0000000
## Part-Time Payroll (PT_PAY) 0.9944174
## Full-Time Equivalent Employment (FTE) 0.9642614
## Total Full-Time and Part-Time Employment (TOT_EMP) 0.9747743
## Total Full-Time and Part-Time Payroll (TOT_PAY) 0.9653949
## Part-Time Payroll (PT_PAY)
## Full-Time Employment (FT_EMP) 0.9575117
## Full-Time Payroll (FT_PAY) 0.9641246
## Part-Time Employment (PT_EMP) 0.9944174
## Part-Time Payroll (PT_PAY) 1.0000000
## Full-Time Equivalent Employment (FTE) 0.9646737
## Total Full-Time and Part-Time Employment (TOT_EMP) 0.9739691
## Total Full-Time and Part-Time Payroll (TOT_PAY) 0.9696141
## Full-Time Equivalent Employment (FTE)
## Full-Time Employment (FT_EMP) 0.9996222
## Full-Time Payroll (FT_PAY) 0.9958675
## Part-Time Employment (PT_EMP) 0.9642614
## Part-Time Payroll (PT_PAY) 0.9646737
## Full-Time Equivalent Employment (FTE) 1.0000000
## Total Full-Time and Part-Time Employment (TOT_EMP) 0.9990585
## Total Full-Time and Part-Time Payroll (TOT_PAY) 0.9960044
## Total Full-Time and Part-Time Employment (TOT_EMP)
## Full-Time Employment (FT_EMP) 0.9975601
## Full-Time Payroll (FT_PAY) 0.9950649
## Part-Time Employment (PT_EMP) 0.9747743
## Part-Time Payroll (PT_PAY) 0.9739691
## Full-Time Equivalent Employment (FTE) 0.9990585
## Total Full-Time and Part-Time Employment (TOT_EMP) 1.0000000
## Total Full-Time and Part-Time Payroll (TOT_PAY) 0.9960184
## Total Full-Time and Part-Time Payroll (TOT_PAY)
## Full-Time Employment (FT_EMP) 0.9953080
## Full-Time Payroll (FT_PAY) 0.9997684
## Part-Time Employment (PT_EMP) 0.9653949
## Part-Time Payroll (PT_PAY) 0.9696141
## Full-Time Equivalent Employment (FTE) 0.9960044
## Total Full-Time and Part-Time Employment (TOT_EMP) 0.9960184
## Total Full-Time and Part-Time Payroll (TOT_PAY) 1.0000000
The correlation matrix showed strong positive relationships among all seven variables. For example, full-time employment and full-time payroll had a correlation of approximately 0.996. Part-time employment and part-time payroll had a correlation of approximately 0.994. These results indicate that observations with higher employment counts generally also had higher total payroll.
The pairs() command was used to visualize the same
variables.
pairs(gov_data[, c(5, 6, 7, 8, 10, 11, 12)])
The scatterplot matrix showed that many observations were clustered near the lower ends of the scales, while a few observations had much larger employment and payroll values. These differences in scale may influence the correlations and should be considered when interpreting the results.
Spearman’s rank correlation was used to examine the relationship between part-time employment and part-time payroll.
cor.test(gov_data[[7]], gov_data[[8]],
method = "spearman")
## Warning in cor.test.default(gov_data[[7]], gov_data[[8]], method = "spearman"):
## cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: gov_data[[7]] and gov_data[[8]]
## S = 27179962, p-value < 2.2e-16
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.9788632
The Spearman correlation coefficient was approximately 0.979, indicating a very strong positive association between part-time employment and part-time payroll. The p-value was less than 2.2 × 10⁻¹⁶, providing strong statistical evidence against the null hypothesis of no rank correlation.
Spearman’s method was selected because it measures the strength and direction of a monotonic relationship using ranks and is less sensitive to extreme observations than Pearson’s correlation. The scatterplot matrix showed several observations with much larger values than others, making Spearman a reasonable choice. The warning about tied values indicates that R calculated an approximate rather than exact p-value.
The analysis found strong positive associations among government employment and payroll variables. In particular, part-time employment and part-time payroll had a Spearman correlation of approximately 0.979. This suggests that observations with more part-time employees generally had higher part-time payroll. However, correlation does not establish causation, and the large differences in observation sizes should be considered when interpreting these findings.