Daniel Lee 3/8/2021
Source of data https://www.datafiles.samhsa.gov/study-series/national-mental-health-services-survey-n-mhss-nid13521
The data came from SAMHDA, National Mental Health Services Survey, 2019 and 2010. Selected are the variables that start with TREAT (indicating the type of treatment).
A good brief reading on the history of mental illness treatments https://dualdiagnosis.org/mental-health-and-addiction/history/
# load package
library(readr) #for read_csv() function
library(tidyverse)
<- "C:/Users/sclee1/OneDrive/Documents/R/Madness/data/"
DIR # import data
load(paste0(DIR,"nmhss_2019_puf_R.RData"))
load(paste0(DIR, "N-MHSS-2010-DS0001-data-r.rda"))
rename data
<- PUF
treat2019 <- da34945.0001 treat2010
Create function to clean data
<- function(x){
clean #select variables that start with TREAT
select(x, starts_with("TREAT")) %>%
mutate(n_total = n()) %>%
pivot_longer(-n_total, names_to = "Treatment", values_to = "count") %>%
mutate(count = as.numeric(stringr::str_extract(count, "\\d"))) %>% #for2010 that has (0)No, (1)Yes
group_by(Treatment) %>%
summarise(n = sum(count, na.rm = TRUE),
n_total = mean(n_total)) %>%
ungroup() %>%
transmute(Treatment, percent = n / n_total) %>%
mutate(Treatment = case_when(
== "TREATPSYCHOTHRPY" ~ "psychotherapy",
Treatment == "TREATFAMTHRPY" ~ "family therapy",
Treatment == "TREATGRPTHRPY" ~ "group therapy",
Treatment == "TREATCOGTHRPY" ~ "cognitive behavioral therapy",
Treatment == "TREATDIALTHRPY" ~ "dialectical behavior therapy",
Treatment == "TREATBEHAVMOD" ~ "behavior modification",
Treatment == "TREATDUALMHSA" ~ "integrated dual disorders treatment",
Treatment == "TREATTRAUMATHRPY" ~ "trauma therapy",
Treatment == "TREATACTVTYTHRPY" ~ "activity therapy",
Treatment == "TREATELECTRO" ~ "electroconvulsive therapy",
Treatment == "TREATTELEMEDINCE" ~ "telemedicine therapy",
Treatment == "TREATPSYCHOMED" ~ "psychotropic medication",
Treatment == "TREATOTH" ~ "mentalhealth treatment approach",
Treatment == "TREATMT" ~ "substanceuse treatment",
Treatment TRUE ~ as.character(Treatment)))
}
Clean data
<- clean(treat2010)
treat10_cleaned <- clean(treat2019) treat19_cleaned
Rename percent column
<- treat10_cleaned %>% rename(percent10 = percent)
treat10_cleaned <- treat19_cleaned %>% rename(percent19 = percent) treat19_cleaned
<- treat19_cleaned %>%
treat_joined left_join(treat10_cleaned) %>%
mutate(percent10 = ifelse(is.na(percent10), 0, percent10),
Treatment = fct_reorder(Treatment, percent19)) %>%
pivot_longer(names_to = "Year", values_to = "Percent", - Treatment) %>%
mutate(Year = stringr::str_remove(Year, "percent"),
Year = paste0("20",Year))
## Joining, by = "Treatment"
treat_joined
## # A tibble: 28 x 3
## Treatment Year Percent
## <fct> <chr> <dbl>
## 1 activity therapy 2019 0.446
## 2 activity therapy 2010 0.451
## 3 behavior modification 2019 0.660
## 4 behavior modification 2010 0.574
## 5 cognitive behavioral therapy 2019 0.902
## 6 cognitive behavioral therapy 2010 0.777
## 7 dialectical behavior therapy 2019 0.563
## 8 dialectical behavior therapy 2010 0
## 9 integrated dual disorders treatment 2019 0.566
## 10 integrated dual disorders treatment 2010 0.479
## # ... with 18 more rows
%>%
treat_joined ggplot(aes(Percent, Treatment, fill = Year)) +
geom_col(position = "dodge", alpha = 0.8) +
scale_x_continuous(labels = scales::percent_format()) +
labs(title = "Common Mental Illness Treatments in the U.S.",
y = NULL,
x = "% of Facilities with Treatment",
caption = "Data Source: SAMHDA, National Mental Health Services Survey")