library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## âś” dplyr 1.2.0 âś” readr 2.1.6
## âś” forcats 1.0.1 âś” stringr 1.6.0
## âś” ggplot2 4.0.1 âś” tibble 3.3.1
## âś” lubridate 1.9.5 âś” tidyr 1.3.2
## âś” purrr 1.2.1
## ── 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(readxl)
fema_data <- read_excel("fema_data.xlsx", sheet = "Core Survey", skip = 1)
## Warning: Expecting logical in LS1120 / R1120C331: got 'there is no third
## gender'
## Warning: Expecting logical in MO1246 / R1246C353: got 'normal'
## Warning: Expecting logical in MO1414 / R1414C353: got 'Fluid'
## Warning: Expecting logical in LS1963 / R1963C331: got 'Transgender'
## Warning: Expecting logical in MO2184 / R2184C353: got 'Genderfluid'
## Warning: Expecting logical in LS2311 / R2311C331: got 'Trans'
## Warning: Expecting logical in MO2699 / R2699C353: got 'Transgender'
## Warning: Expecting logical in MO2830 / R2830C353: got 'Nothing in particular'
## Warning: Expecting logical in MO3048 / R3048C353: got 'Good'
## Warning: Expecting logical in MO3304 / R3304C353: got 'Transgender'
## Warning: Expecting logical in LS4642 / R4642C331: got 'Transgender Female'
## Warning: Expecting logical in MO5355 / R5355C353: got 'Femal'
## Warning: Expecting logical in LS5609 / R5609C331: got 'There are two sexes,
## male and female. I'm a male.'
## Warning: Expecting logical in MO6038 / R6038C353: got 'Transgender'
## Warning: Expecting logical in LS6358 / R6358C331: got 'Transgender Male (FTM)'
## Warning: Expecting logical in MO7225 / R7225C353: got 'solo ager'
#level of self perceived preparedness
table(fema_data$dis_soc)
##
## Don't know
## 387
## I am NOT prepared, and I do not intend to prepare in the next year
## 736
## I am NOT prepared, but I intend to get prepared in the next six months
## 1505
## I am NOT prepared, but I intend to start preparing in the next year
## 1252
## I have been prepared for LESS than a year
## 1357
## I have been prepared for MORE than a year and I continue preparing
## 2367
#is there a perceived threat from disaster
table(fema_data$dis_iperception)
##
## No Unknown Yes
## 1457 619 5528
#individual identifies as having a disability
table(fema_data$disability)
##
## Disability No Disability
## 1855 5749
#levels of preparedness as factors
fema_data$dis_soc <- as.factor(fema_data$dis_soc)
levels(fema_data$dis_soc)
## [1] "Don't know"
## [2] "I am NOT prepared, and I do not intend to prepare in the next year"
## [3] "I am NOT prepared, but I intend to get prepared in the next six months"
## [4] "I am NOT prepared, but I intend to start preparing in the next year"
## [5] "I have been prepared for LESS than a year"
## [6] "I have been prepared for MORE than a year and I continue preparing"
#disaster perception: remove unknowns
fema_compare <- subset(fema_data, dis_iperception %in% c("Yes", "No"))
#convert preparedness levels to numerics
fema_compare$prep_numeric <- as.numeric(fema_compare$dis_soc)
#convert disability status to numeric
fema_compare$disability_numeric <- ifelse(fema_compare$disability == "Yes", 1, 0)
# Frequency table to identify the most common disability answer
fema_disability_mode_table<-fema_compare %>% group_by(disability) %>% summarize(count_of_x=n()) %>% arrange(-count_of_x)
head(fema_disability_mode_table)
## # A tibble: 2 Ă— 2
## disability count_of_x
## <chr> <int>
## 1 No Disability 5277
## 2 Disability 1708
# Frequency table to identify the most common preparedness level
prep_mode_table <- fema_compare %>% group_by(prep_numeric) %>% summarize(count_of_prep = n()) %>% arrange(-count_of_prep)
prep_mode_table
## # A tibble: 6 Ă— 2
## prep_numeric count_of_prep
## <dbl> <int>
## 1 6 2258
## 2 3 1402
## 3 5 1292
## 4 4 1136
## 5 2 641
## 6 1 256
# Mean and median preparedness for respondents with disabilities
disability_mean <- mean(fema_compare$prep_numeric[fema_compare$disability == "Disability"], na.rm = TRUE)
disability_median <- median(fema_compare$prep_numeric[fema_compare$disability == "Disability"], na.rm = TRUE)
# Mean and median preparedness for respondents with no disabilities
no_disability_mean <- mean(fema_compare$prep_numeric[fema_compare$disability == "No Disability"], na.rm = TRUE)
no_disability_median <- median(fema_compare$prep_numeric[fema_compare$disability == "No Disability"], na.rm = TRUE)
# Histogram of preparedness with Disability
hist(fema_compare$prep_numeric[fema_compare$disability == "Disability"],
breaks = 6,
probability = TRUE)
lines(density(fema_compare$prep_numeric[fema_compare$disability == "Disability"]),
col = "red",
lwd = 3)
abline(v = disability_mean, col = "blue", lwd = 5)
abline(v = disability_median, col = "green", lwd = 5)

# Histogram of preparedness with No Disability
hist(fema_compare$prep_numeric[fema_compare$disability == "No Disability"],
breaks = 6,
probability = TRUE)
lines(density(fema_compare$prep_numeric[fema_compare$disability == "No Disability"]),
col = "red",
lwd = 3)
abline(v = no_disability_mean, col = "blue", lwd = 5)
abline(v = no_disability_median, col = "green", lwd = 5)

ggplot(fema_compare, aes(x = disability, y = prep_numeric)) +
geom_boxplot()

#Null hypothesis: There is no difference in disaster preparedness levels between individuals with disabilities and those without disabilities.
#Alternative hypothesis: There is a difference in disaster preparedness levels between individuals with disabilities and those without disabilities.
t.test(prep_numeric ~ disability, data = fema_compare)
##
## Welch Two Sample t-test
##
## data: prep_numeric by disability
## t = -0.80006, df = 2800.7, p-value = 0.4237
## alternative hypothesis: true difference in means between group Disability and group No Disability is not equal to 0
## 95 percent confidence interval:
## -0.11793355 0.04958249
## sample estimates:
## mean in group Disability mean in group No Disability
## 4.311475 4.345651
#In this analysis I examine whether disability status plays a role in disaster preparedness among respondents in the FEMA National Household Survey on Disaster Preparedness. Disaster preparedness refers to the actions individuals take to prepare for potential disasters, such as creating emergency plans or assembling disaster supply kits. Understanding whether certain populations are less prepared is important for emergency management agencies, because it can help identify groups that may require additional outreach or support before disasters occur. Individuals with disabilities are often considered a population with additional needs during emergencies, so it is reasonable to explore whether disability status is associated with different levels of preparedness.
#The dependent variable in this analysis is self-reported disaster preparedness level, which is measured by the variable dis_soc in the dataset. This variable records how prepared respondents believe they are for a disaster, with responses ranging from not being prepared at all to having been prepared for more than a year and continuing to prepare. For the purposes of analysis, these responses were converted into a numeric scale (prep_numeric) so that differences in preparedness levels could be examined using statistical tools and visualizations. Higher values on this scale represent higher levels of reported preparedness.
#The independent variable is disability status, measured by the variable disability in the dataset. This variable identifies whether a respondent reports having a disability or not. Because disability status may influence how individuals prepare for disasters—due to factors such as mobility limitations, medical needs, or access to resources—it is plausible that preparedness levels could differ between respondents with disabilities and those without disabilities.
#Based on these variables, the null hypothesis states that there is no difference in disaster preparedness levels between individuals with disabilities and those without disabilities. In other words, disability status has no effect on preparedness. The alternative hypothesis states that there is a difference in disaster preparedness levels between individuals with disabilities and those without disabilities. Testing these hypotheses allows us to determine whether disability status appears to influence preparedness within this survey data.