Poverty Rate in Maryland 2010-2022

Author

Hannah Le

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ 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(tidyr)
library(leaflet)
library(highcharter)
Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 
Highcharts (www.highcharts.com) is a Highsoft software product which is
not free for commercial and Governmental use
setwd("/Users/itshannahuc/Desktop/Data 110")
Poverty_Rate <-read_csv ("~/Desktop/Data 110/Poverty_Rate_With_Margin_Of_Error__2010-2022_20241112.csv")
Rows: 48 Columns: 32
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): Attribute, Value, Attribute (2), Attribute (3), Value (3), Attribu...
dbl (26): Allegany County, Anne Arundel County, Baltimore City, Baltimore Co...

ℹ 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.

Visible and Invisible Inequalities

Visible and Invisible Inequalities

Description of the Dataset

“Analysis of Poverty Trends in Maryland Counties from 2010 to 2022” This topic is important because knowledge of local poverty rates can help academics and policymakers allocate resources and target initiatives. The dataset enables the investigation of poverty patterns across time and the discovery of differences between Maryland counties.

Open Portal MD is the source. Variables: Poverty rates (continuous, numerical) by county. Overall poverty measures in Maryland (both numerical and qualitative, such as “Poverty Rate” and “Margin of Error”). Year is a categorical temporal attribute. By standardizing column names, converting date fields, and making sure numerical columns are in the right forms for statistical analysis, the data was cleaned. Finding patterns and geographical differences in poverty rates requires knowledge of this subject. Policymakers can create programs that effectively reduce poverty by having a better understanding of these trends.

Analysis Using dplyr

# Check the class of the dataset
class(Poverty_Rate)
[1] "spec_tbl_df" "tbl_df"      "tbl"         "data.frame" 
# View the structure of the dataset
str(Poverty_Rate)
spc_tbl_ [48 × 32] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
 $ Allegany County       : num [1:48] 17.1 3 19.1 3.4 18.1 2.8 18.6 3.3 18.5 2.7 ...
 $ Anne Arundel County   : num [1:48] 6.6 1.1 6.5 1.2 6.3 1 7.3 1.1 6.7 1.1 ...
 $ Baltimore City        : num [1:48] 24.7 1.8 24.5 1.7 24.5 1.7 22.7 1.6 23.3 1.8 ...
 $ Baltimore County      : num [1:48] 8.2 1.2 9.6 1.2 9.7 1 9.5 1 9.8 1.1 ...
 $ Calvert County        : num [1:48] 6.2 1.4 6.1 1.5 7 1.3 6.9 1.4 7.2 1.4 ...
 $ Caroline County       : num [1:48] 13 2.8 13.1 2.7 15.7 2.7 16.7 2.8 16 3 ...
 $ Carroll County        : num [1:48] 5.4 1.1 5.5 1.2 6.3 1.1 6.8 1.2 5.9 1.2 ...
 $ Cecil County          : num [1:48] 10.5 2 9.7 2.2 11.9 1.9 9.8 2 10.6 2 ...
 $ Charles County        : num [1:48] 6.2 1.4 7.7 1.5 8.6 1.3 8 1.5 7.2 1.5 ...
 $ Dorchester County     : num [1:48] 16.2 3.2 17.5 3.3 18.4 2.9 17.7 3.3 17.5 3.6 ...
 $ Frederick County      : num [1:48] 5.6 1.2 6.6 1.2 6.8 1.1 6.9 1.2 6.5 1.2 ...
 $ Garrett County        : num [1:48] 15.1 3.1 12 2.9 14.5 2.6 15.9 2.9 12.4 3 ...
 $ Harford County        : num [1:48] 6.9 1.4 8.3 1.2 7.9 1 7.4 1.2 8 1.2 ...
 $ Howard County         : num [1:48] 5.2 1.1 6 1.1 5.3 1 5.3 1.1 6.1 1.1 ...
 $ Kent County           : num [1:48] 14.2 3.1 13.9 3.4 14 3.1 14.9 3.2 13.8 3.3 ...
 $ Montgomery County     : num [1:48] 7.5 0.8 6.7 0.8 6.6 0.8 7 0.9 7.2 0.9 ...
 $ Prince George's County: num [1:48] 9.4 1.2 9.4 1 10.3 0.9 9.9 1 10.3 1.2 ...
 $ Queen Anne's County   : num [1:48] 7.3 1.7 8.7 1.7 8.2 1.6 8.4 1.8 7.5 1.9 ...
 $ Somerset County       : num [1:48] 19.3 5.5 26.2 6 29.6 6.2 28.5 5.7 25.5 6 ...
 $ St. Mary's County     : num [1:48] 7.5 1.9 8.6 1.8 8.4 1.7 8.2 1.8 8.6 1.8 ...
 $ Talbot County         : num [1:48] 9.7 2.2 10.8 2.2 9.7 2.1 10.9 2.2 11.7 2.2 ...
 $ Washington County     : num [1:48] 11.4 2.1 11.8 1.7 13.7 1.9 12 2.1 13.8 2 ...
 $ Wicomico County       : num [1:48] 16.6 2.8 17.7 2.6 16.7 2.6 16.5 2.8 16.9 2.7 ...
 $ Worcester County      : num [1:48] 10.6 2.7 13 2.6 11.1 2.4 13.1 2.5 11.9 2.4 ...
 $ Attribute             : chr [1:48] "Date Created" "Date Created" "Date Created" "Date Created" ...
 $ Value                 : chr [1:48] "10/4/2022" "10/4/2022" "10/4/2022" "10/4/2022" ...
 $ Attribute (2)         : chr [1:48] "Year" "Year" "Year" "Year" ...
 $ Value (2)             : num [1:48] 2010 2010 2011 2011 2012 ...
 $ Attribute (3)         : chr [1:48] "Estimate" "Estimate" "Estimate" "Estimate" ...
 $ Value (3)             : chr [1:48] "Poverty Rate" "MOE" "Poverty Rate" "MOE" ...
 $ Attribute (4)         : chr [1:48] "MARYLAND" "MARYLAND" "MARYLAND" "MARYLAND" ...
 $ Value (4)             : num [1:48] 9.9 0.3 10.2 0.3 10.4 0.3 10.2 0.3 10.4 0.3 ...
 - attr(*, "spec")=
  .. cols(
  ..   `Allegany County` = col_double(),
  ..   `Anne Arundel County` = col_double(),
  ..   `Baltimore City` = col_double(),
  ..   `Baltimore County` = col_double(),
  ..   `Calvert County` = col_double(),
  ..   `Caroline County` = col_double(),
  ..   `Carroll County` = col_double(),
  ..   `Cecil County` = col_double(),
  ..   `Charles County` = col_double(),
  ..   `Dorchester County` = col_double(),
  ..   `Frederick County` = col_double(),
  ..   `Garrett County` = col_double(),
  ..   `Harford County` = col_double(),
  ..   `Howard County` = col_double(),
  ..   `Kent County` = col_double(),
  ..   `Montgomery County` = col_double(),
  ..   `Prince George's County` = col_double(),
  ..   `Queen Anne's County` = col_double(),
  ..   `Somerset County` = col_double(),
  ..   `St. Mary's County` = col_double(),
  ..   `Talbot County` = col_double(),
  ..   `Washington County` = col_double(),
  ..   `Wicomico County` = col_double(),
  ..   `Worcester County` = col_double(),
  ..   Attribute = col_character(),
  ..   Value = col_character(),
  ..   `Attribute (2)` = col_character(),
  ..   `Value (2)` = col_double(),
  ..   `Attribute (3)` = col_character(),
  ..   `Value (3)` = col_character(),
  ..   `Attribute (4)` = col_character(),
  ..   `Value (4)` = col_double()
  .. )
 - attr(*, "problems")=<externalptr> 
# Convert to tibble if necessary
Poverty_Rate <- as_tibble(Poverty_Rate)

# Clean column names if necessary
library(janitor)

Attaching package: 'janitor'
The following objects are masked from 'package:stats':

    chisq.test, fisher.test
Poverty_Rate <- clean_names(Poverty_Rate)

# Group by 'Year' column
grouped_data <- Poverty_Rate %>%
  group_by(value_2) %>%
  summarize(mean_poverty = mean(Poverty_Rate, na.rm = TRUE))
Warning: There were 13 warnings in `summarize()`.
The first warning was:
ℹ In argument: `mean_poverty = mean(Poverty_Rate, na.rm = TRUE)`.
ℹ In group 1: `value_2 = 2010`.
Caused by warning in `mean.default()`:
! argument is not numeric or logical: returning NA
ℹ Run `dplyr::last_dplyr_warnings()` to see the 12 remaining warnings.

Regresssion Analysis

# Fit a linear model
model <- lm(value_4 ~ value_2, data = Poverty_Rate)

# Diagnostic plots
par(mfrow = c(2, 2))
plot(model)

Summary of model

summary(model)

Call:
lm(formula = value_4 ~ value_2, data = Poverty_Rate)

Residuals:
   Min     1Q Median     3Q    Max 
-5.049 -4.789 -0.154  4.814  5.416 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)
(Intercept) 110.14987  403.63582   0.273    0.786
value_2      -0.05214    0.20026  -0.260    0.796

Residual standard error: 4.889 on 46 degrees of freedom
Multiple R-squared:  0.001471,  Adjusted R-squared:  -0.02024 
F-statistic: 0.06779 on 1 and 46 DF,  p-value: 0.7957
colnames(Poverty_Rate)
 [1] "allegany_county"       "anne_arundel_county"   "baltimore_city"       
 [4] "baltimore_county"      "calvert_county"        "caroline_county"      
 [7] "carroll_county"        "cecil_county"          "charles_county"       
[10] "dorchester_county"     "frederick_county"      "garrett_county"       
[13] "harford_county"        "howard_county"         "kent_county"          
[16] "montgomery_county"     "prince_georges_county" "queen_annes_county"   
[19] "somerset_county"       "st_marys_county"       "talbot_county"        
[22] "washington_county"     "wicomico_county"       "worcester_county"     
[25] "attribute"             "value"                 "attribute_2"          
[28] "value_2"               "attribute_3"           "value_3"              
[31] "attribute_4"           "value_4"              
filtered_data <- Poverty_Rate %>%
  filter(value_2 %in% c(2010,2011,2012,2013,2014,2015,2017,2018,2019,2020,2021,2022,2023)) %>%  # Use `value_2` to filter by year
  mutate(value_2 = as.character(value_2))   

Create a long format data (TEST)

long_data <- Poverty_Rate %>%
  pivot_longer(cols = c(allegany_county, anne_arundel_county, baltimore_county), 
               names_to = "county", 
               values_to = "poverty_rate")

# Generate the Highchart
highchart() %>%
  hc_chart(type = "line") %>%
  hc_title(text = "Poverty Rates by County and Year") %>%
  hc_xAxis(categories = c("2010", "2018", "2022")) %>%
  hc_yAxis(title = list(text = "Poverty Rate")) %>%
  hc_add_series(data = filter(long_data, county == "allegany_county")$poverty_rate,
                name = "Allegany County") %>%
  hc_add_series(data = filter(long_data, county == "anne_arundel_county")$poverty_rate,
                name = "Anne Arundel County") %>%
  hc_add_series(data = filter(long_data, county == "baltimore_county")$poverty_rate,
                name = "Baltimore County") %>%
  hc_plotOptions(line = list(marker = list(enabled = TRUE)))  # Show data points

Test #2

long_data <- Poverty_Rate %>%
  pivot_longer(cols = c(st_marys_county, washington_county, montgomery_county), 
               names_to = "county", 
               values_to = "poverty_rate")
highchart() %>%
  hc_chart(type = "column") %>%
  hc_title(text = "Poverty Rate Comparison by County (2010-2022)") %>%
  hc_xAxis(categories = c("2010", "2018", "2022"), title = list(text = "Year")) %>%
  hc_yAxis(title = list(text = "Poverty Rate (%)")) %>%
  hc_add_series(data = filter(long_data, county == "st_marys_county")$poverty_rate,
                name = "St Marys County", color = "#1E90FF", type = "column") %>%
  hc_add_series(data = filter(long_data, county == "washington_county")$poverty_rate,
                name = "Washington County", color = "#32CD32", type = "column") %>%
  hc_add_series(data = filter(long_data, county == "montgomery_county")$poverty_rate,
                name = "Montgomery County", color = "#FF6347", type = "column") %>%
  hc_plotOptions(column = list(dataLabels = list(enabled = TRUE)))

Manually create a data frame for each county with the corresponding years and poverty rates

years <- c(2010,2011,2012,2018,2022)
allegany_poverty_rate <- c(17.1,19.1,18.1,16.7,16.0)  
anne_arundel_poverty_rate <- c(6.6,6.5,6.3,7.0,5.8)  
baltimore_poverty_rate <- c(8.2,9.6,9.7,9.9,8.9)  

# Create the Highchart without pivoting
highchart() %>%
  hc_chart(type = "line") %>%
  hc_title(text = "Poverty Rates by County and Year") %>%
  hc_xAxis(categories = years) %>%  # Set the years directly as categories
  hc_yAxis(title = list(text = "Poverty Rate")) %>%
  hc_add_series(data = allegany_poverty_rate,
                name = "Allegany County") %>%
  hc_add_series(data = anne_arundel_poverty_rate,
                name = "Anne Arundel County") %>%
  hc_add_series(data = baltimore_poverty_rate,
                name = "Baltimore County") %>%
  hc_plotOptions(line = list(marker = list(enabled = TRUE)))  # Show data points

Essay

Between 1% and 3% of people worldwide are thought to have intellectual impairments (ID), which impair their capacity for thought and adaptation. These people frequently experience social exclusion and restricted access to services and healthcare, especially in urban regions with high rates of poverty. The intersection of social poverty and service dependency for individuals with ID is examined in Metzel’s study conducted in Baltimore, Maryland, with a focus on how geographic location and financial difficulties make these issues worse. People with disabilities are frequently underserved by current public services, so the study emphasizes the need for stronger social infrastructure, such as better access to healthcare, housing, and education.

Reference: Metzel, Deborah S. “Places of Social Poverty and Service Dependency of People with Intellectual Disabilities: A Case Study in Baltimore, Maryland.” Health & Place, vol. 11, no. 2, 2005, pp. 93–105, https://doi.org/10.1016/j.healthplace.2004.10.009.

Analyzing the Diagnostic Plot Visualizations: Residuals vs. Fitted: Shows that the residuals are dispersed randomly, indicating a possible decent fit, but the spread is small, indicating that the dataset may have little volatility.

The Q-Q plot shows that mistakes are roughly normally distributed since residuals closely match the theoretical quantiles.

Scale-Location: Although homoscedasticity, or constant variance, appears to exist, the small distribution of data points indicates that the model may not be able to account for a significant amount of variance.

Leverage vs. Residuals: Indicates that no single data point has an excessive impact on the model by displaying no significant outliers.

Regression Summary:

The regression analysis revealed a low R-squared value (0.001471), indicating that the independent variable Year (value_2) accounts for very little of the variation in the dependent variable Average Pov Rate for each county regard the year (value_4). The independent variable (value_2) has a p-value of 0.796, which is far from statistically significant, indicating that the variable does not strongly influence poverty rate trends.

Patterns and insights. The results show a weak connect between the examined variables, which may indicate: The chosen independent variable (value_2) may not be a significant predictor of the poverty rate. Other characteristics, such as education, work, and housing expenses, may have greater predictive power. The dataset may lack variance, limiting its capacity to discover meaningful trends.

Highcharter

This graphic shows the poverty rates for Baltimore, Anne Arundel, and Allegany counties during a five-year period (2010, 2011, 2012, 2018, and 2022). On the chart, each county’s data is shown as a line, with the years on the x-axis and the poverty rate percentage on the y-axis.

Allegany County: In 2011, the poverty rate reached a high of 19.1%, and in 2022, it marginally decreased to 16.0%. According to this, Allegany County saw greater poverty in the early 2010s before gradually improving.

The poverty rate in Anne Arundel County is continuously lower, ranging from 5.8% to 7.0%. The modest increase in 2018 might be a sign of a short-term increase in poverty, but by 2022, it has stabilized.

In Baltimore County, the rate rises from 8.2% in 2010 to 9.7% in 2012. In 2022, it declines somewhat to 8.9%. This suggests a tendency that has been a little erratic, with a slight decline in recent years.