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
Research Question: How does the tuition cost amount vary across different county departments participating in the tuition assistance program?
The data-set I am using contains 4,748 observations and 7 variables, one observations represents one tuition assistance record. The variables are Department, Major, Degree, School, Course Title, Course Description, and Cost. Although there are many variables my analysis will focus on Department and cost. These variables are directly related to my research question. The data set I am using is from the data set folder on Blackboard this is the link: Tuition Assistance | Open Data Portal. I will compare cost amounts from the departments to determine whether there are statistically significant differences in the average amount of tuition assistance they receive.
First I will begin importing the data set and clean it. By cleaning the data and converting the Cost variable from text to a numeric value making it easier to read. Then I will explore the Data using summary statistics and visualizations. After that I will be Creating Histogram and box-plot to analyze the distribution of tuition cost amounts and compare reimbursement costs throughout the departments.
tuition <- read.csv("Tuition_Assistance_.csv")
head(tuition)
## Department Major Degree
## 1 Police Business/Admin./Mgmt. AA
## 2 Police Business/Admin./Mgmt. AA
## 3 Police Business/Admin./Mgmt. AA
## 4 Health & Human Services Business/Admin./Mgmt. Masters (MA/MS/MPH/etc.)
## 5 Health & Human Services Other/Misc. Masters (MA/MS/MPH/etc.)
## 6 Finance Accounting (Business) Masters (MA/MS/MPH/etc.)
## School
## 1 Montgomery College Rockville Campus
## 2 Montgomery College Rockville Campus
## 3 Montgomery College Rockville Campus
## 4 BOWIE STATE UNIVERSITY
## 5 Mount St Mary's University
## 6 University of Maryland - University College
## Course.Title
## 1 INTRODUCTION TO BUSINESS
## 2 MA 160
## 3 INTRO TO AMERICAN MUSIC
## 4 PUBLIC POLICY ANALYSIS
## 5 MHA 500 CONTEMPORARY ISSUES IN HEALTH CARE
## 6 ACCT FINANCIAL MGMT CAPSTONE
## Course.Description
## 1 An introductory course designed to survey the field of business and its environment in order to give the student a broad overview of the principles, practices, institutions, and functions of business.
## 2 A general calculus course primarily for business students. Topics include algebraic, exponential, and logarithmic functions and their graphs; an intuitive approach to limits; differentiation; integration; and functions of several variables. Major emphasis
## 3 A survey of American popular music from the turn of the 20th century to the present with an emphasis on rock music.
## 4 Focus is on the analysis of costs and benefits in the selection of the public policy choices. Students analyze public policy alternatives, factors, and process involved in policy development, including the rulemaking that occurs after legislative enactmen
## 5 The historical, current, and future organization and delivery of \nthe United States health care system is studied. Concepts and \napplications of the system are explored as well as comparisons with international health care paradigms. Introduction to the s
## 6 A synthesis of material from all previous study in financial management and information systems that reflects the importance of information systems in modern organizations and the role of the CFO/CIO in managing this resource to maximize value. Simulation
## Cost
## 1 $392.00
## 2 $392.00
## 3 $392.00
## 4 $1,062.00
## 5 $1,569.00
## 6 $870.00
str(tuition)
## 'data.frame': 4748 obs. of 7 variables:
## $ Department : chr "Police" "Police" "Police" "Health & Human Services" ...
## $ Major : chr "Business/Admin./Mgmt." "Business/Admin./Mgmt." "Business/Admin./Mgmt." "Business/Admin./Mgmt." ...
## $ Degree : chr "AA" "AA" "AA" "Masters (MA/MS/MPH/etc.)" ...
## $ School : chr "Montgomery College Rockville Campus" "Montgomery College Rockville Campus" "Montgomery College Rockville Campus" "BOWIE STATE UNIVERSITY" ...
## $ Course.Title : chr "INTRODUCTION TO BUSINESS" "MA 160" "INTRO TO AMERICAN MUSIC" "PUBLIC POLICY ANALYSIS" ...
## $ Course.Description: chr "An introductory course designed to survey the field of business and its environment in order to give the studen"| __truncated__ "A general calculus course primarily for business students. Topics include algebraic, exponential, and logarithm"| __truncated__ "A survey of American popular music from the turn of the 20th century to the present with an emphasis on rock music." "Focus is on the analysis of costs and benefits in the selection of the public policy choices. Students analyze "| __truncated__ ...
## $ Cost : chr "$392.00" "$392.00" "$392.00" "$1,062.00" ...
summary(tuition)
## Department Major Degree School
## Length :4748 Length :4748 Length :4748 Length :4748
## N.unique : 34 N.unique : 93 N.unique : 9 N.unique : 408
## N.blank : 0 N.blank : 0 N.blank : 0 N.blank : 0
## Min.nchar: 6 Min.nchar: 3 Min.nchar: 2 Min.nchar: 4
## Max.nchar: 58 Max.nchar: 64 Max.nchar: 24 Max.nchar: 84
## Course.Title Course.Description Cost
## Length :4748 Length : 4748 Length :4748
## N.unique :3567 N.unique : 4145 N.unique :1030
## N.blank : 0 N.blank : 214 N.blank : 0
## Min.nchar: 3 Min.nchar: 0 Min.nchar: 5
## Max.nchar: 156 Max.nchar:12058 Max.nchar: 9
tuition_clean <- tuition %>%
select(Department, Cost) %>%
mutate(
Cost = gsub("\\$", "", Cost),
Cost = gsub(",", "", Cost),
Cost = as.numeric(Cost),
Department = as.factor(Department)
) %>%
filter(!is.na('Cost'),
!is.na('Department'))
head(tuition_clean)
## Department Cost
## 1 Police 392
## 2 Police 392
## 3 Police 392
## 4 Health & Human Services 1062
## 5 Health & Human Services 1569
## 6 Finance 870
tuition_clean %>%
group_by(Department) %>%
summarise(
Count = n(),
Mean = mean(Cost),
Median = median(Cost),
Maximum = max(Cost),
Minimum = min(Cost)
)
## # A tibble: 34 × 6
## Department Count Mean Median Maximum Minimum
## <fct> <int> <dbl> <dbl> <dbl> <dbl>
## 1 Alcohol Beverage Services 89 798. 580 2200 0
## 2 Animal services 7 509. 347. 1830 116.
## 3 Board of Elections 3 895 900 900 885
## 4 Community Engagement Cluster 13 1086. 1000 1830 470
## 5 Community Use Public Facilities 45 613. 483. 2300 0
## 6 Consumer Protection 4 990 965 1900 130
## 7 Correction & Rehabilitation 227 890. 800 2130 0
## 8 County Attorney 25 395. 336 882 0
## 9 County Council 8 1285. 1150 2300 552
## 10 County Executive 1 336 336 336 336
## # ℹ 24 more rows
ggplot(tuition_clean,
aes(x = Cost)) +
geom_histogram(binwidth = 250,
fill = "blue",
color = "black") +
labs(title = "Distribution of Tuition Cost",
x = "Cost ($)",
y = "Frequency")
tuition_clean$Cost <- as.numeric(tuition_clean$Cost)
ggplot(tuition_clean,
aes(x = Department,
y = Cost)) +
geom_boxplot(fill = "lightgreen") +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
labs(title = "Tuition Cost by Department",
x = "Department",
y = "Cost ($)")
Now to determine whether the average tuition cost amount differs in department, I will conduct a one-way ANOVA test. The independent variable in the analysis is the department, this represents the groups participating in the tuition assistance. The dependent variable is the tuition cost, this represents the amount of amount of assistance given in each department. This test is a accurate becuase my research question compares the mean cost amount in the departments.
**H0:μ1=μ2=μ3=⋯=μk**
The mean tuition assistance cost is the same for all departments participating in the tuition assistance program.
**H1:At least one μi is different**
At least one department has a different mean tuition assistance cost compared to the other county departments.
anova_result <- aov(Cost ~ Department,
data = tuition_clean)
summary(anova_result)
## Df Sum Sq Mean Sq F value Pr(>F)
## Department 33 3.354e+07 1016402 3.621 1.49e-11 ***
## Residuals 4714 1.323e+09 280665
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
aggregate(Cost ~ Department,
data = tuition_clean,
mean)
## Department Cost
## 1 Alcohol Beverage Services 797.9437
## 2 Animal services 509.1429
## 3 Board of Elections 895.0000
## 4 Community Engagement Cluster 1086.3269
## 5 Community Use Public Facilities 612.5444
## 6 Consumer Protection 990.0000
## 7 Correction & Rehabilitation 890.0459
## 8 County Attorney 395.2240
## 9 County Council 1284.8750
## 10 County Executive 336.0000
## 11 Department of Technology and Enterprise Business Solutions 789.4613
## 12 Emergency Mgmt & Homeland Security 1150.0000
## 13 Environmental Protection 670.1549
## 14 Finance 673.0897
## 15 Fire/Rescue Services 764.0519
## 16 General Services 694.7991
## 17 Health & Human Services 850.3012
## 18 Housing & Community Affairs 587.8480
## 19 Human Resources 978.5909
## 20 Human Rights 565.0000
## 21 Investment Trustees 959.7619
## 22 Legislative Oversight 1320.0000
## 23 Libraries 842.0067
## 24 Management & Budget 659.1176
## 25 Office of Labor Relations 1255.3900
## 26 Office of Racial Equity and Social Justice 345.0000
## 27 Permitting Services 919.2424
## 28 Police 801.1390
## 29 Procurement 1240.0000
## 30 Public Information 504.4000
## 31 Recreation 660.4120
## 32 Sheriff 919.6500
## 33 State's Attorney 564.4738
## 34 Transportation 716.8790
The ANOVA results showed that there was a statistically significant difference in tuition assistance costs among county departments. Since the p-value (1.49 × 10⁻¹¹) is less than the significance level of α = 0.05, we reject the null hypothesis. This provides sufficient evidence that the average tuition assistance costs are not the same across all county departments.
The purpose of this analysis was to determine whether tuition assistance costs vary across different departments participating in the tuition assistance program. The one-way ANOVA was showed a statistically significant difference between departments, with an F-statistic of **F(33, 4714) = 3.621** and a p-value of **1.49 × 10⁻¹¹**. Since the p-value was smaller than the significance level of **α = 0.05**, the null hypothesis was rejected. This indicates that the average tuition assistance cost is not the same across all departments and that at least one department has a significantly different average cost compared to the others. These findings suggest that county departments may differ in the amount of tuition assistance costs associated with their Departments. For future research, this analysis could expanded by including additional variables from the data set to better understand what factors influence tuition assistance costs. For example, we could examine whether the cost is related to the type of education program.