PTSD and trauma are widely researched within pyschology. Investigating responses to stimuli and the emotions they elicit is important for undertsnading PTSD further and developing more effective treatment methods. The following data is take from “Psychological Response Data on the Traumatic Nature of 600 Written Events”(Jones, Bellet, Levari, McNally, 2021).A survey of 250 participants responses to 600 written descriptions of potentially traumatic scenarios.
My plot will visualise the relationship between trauma stimuli and trauma ratings. Attempting to identify certain stimuli as more traumatic. This could build onto future research which identifies why phrasing of stimuli could lead these to be percieved as more traumatic than simular traumatic stimuli.
### read and show first lines of original dataset
setwd("C:/Users/njrob/Desktop/Masters/Data-analysis + visualisations/finalproject/Repositry/PSY6422_assignment1")
original_dataset <- read_csv(here("data", "raw", "originaldataset.csv"))
## Rows: 250 Columns: 614
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## chr (11): ParticipantID, PreviousDiagnosis_YesNo, PreviousDiagnosis_List, P...
## dbl (602): Set, witnessed a leaf falling from a tree, lost a foot due to fro...
## lgl (1): Race_Other
##
## i Use `spec()` to retrieve the full column specification for this data.
## i Specify the column types or set `show_col_types = FALSE` to quiet this message.
#head(original_dataset) # the first 7 lines of data
head(original_dataset, n =5)
## # A tibble: 5 x 614
## ParticipantID Set `witnessed a leaf fall~` `lost a foot d~` `witnessed a s~`
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 P6 1 1 7 7
## 2 P8 1 1 7 7
## 3 P11 1 1 7 7
## 4 P14 1 1 6 6
## 5 P22 1 1 7 7
## # ... with 609 more variables: `was tackled by a security officer` <dbl>,
## # `visited family members in another country` <dbl>,
## # `received chemotherapy` <dbl>,
## # `watched a consensual pornographic film involving violence` <dbl>,
## # `was in a boat that capsized during a storm` <dbl>,
## # `lost a finger during an IED explosion` <dbl>,
## # `was injured by a propane tank explosion` <dbl>, ...
#Partipants 137 and 146 are removed because they show consistently high responses among all scenarios indicating them as outliers
df1 <- original_dataset[-c(137, 146)]
#removing questions and demographic data - focusing on scenarios where a traumatic event is witnessed.
df2 <- df1 [c(5,9, 17, 22, 29, 43, 46, 84)]
df3 <- na.omit(df2, cols=c("5","9","17","22","29","43", "46", "84"))
head(df3)
## # A tibble: 6 x 8
## `witnessed a stranger bei~` `watched a con~` `witnessed a f~` `witnessed mai~`
## <dbl> <dbl> <dbl> <dbl>
## 1 7 7 5 7
## 2 7 1 5 5
## 3 7 3 5 6
## 4 6 4 6 3
## 5 7 7 6 7
## 6 7 4 2 7
## # ... with 4 more variables: `witnessed a friend being beaten to death` <dbl>,
## # `witnessed father beat mother until bloody` <dbl>,
## # `watched a movie in which several children were shot and killed` <dbl>,
## # `witnessed a stranger being stabbed` <dbl>
colnames(df3) <- c("Q_1", "Q_2", "Q_3", "Q_3", "Q_4", "Q_5", "Q_6", "Q_7", "Q_8")
new <- c("Extremely Traumatic", "Traumatic", "Somewhat Traumatic", "Neutral", "Somewhat Not Traumatic", "Mostly Not Traumatic", "Not At All Traumatic")
table(df3$Q_1)
##
## 4 5 6 7
## 3 5 10 27
table(df3$Q_2)
##
## 1 2 3 4 5 6 7
## 9 3 11 11 2 4 5
table(df3$Q_3)
##
## 1 2 3 4 5 6 7
## 2 13 4 9 10 5 2
table(df3$Q_4)
##
## 2 4 5 6 7
## 1 1 3 6 34
table(df3$Q_5)
##
## 2 4 5 6 7
## 1 1 6 14 23
table(df3$Q_6)
##
## 1 2 3 4 5 6 7
## 3 15 7 6 3 3 8
table(df3$Q_7)
##
## 2 3 4 5 6 7
## 1 2 2 14 11 15
mytab <- data.frame( Response = c("Extremely Traumatic", "Traumatic", "Somewhat Traumatic", "Neutral", "Somewhat Not Traumatic", "Mostly Not Traumatic", "Not At All Traumatic"),
Q_1 = c(27,10,5,3,0,0,0),
Q_2 = c(5,4,2,11,11,3,9),
Q_3 = c(2,5,10,9,4,13,2),
Q_4 = c(34,6,3,1,0,1,0),
Q_5 = c(23,14,6,1,0,1,0),
Q_6 = c(8,3,3,6,7,15,3),
Q_7 = c(15,11,14,2,2,1,0))
view(mytab)
data2 <- mytab %>% gather(key = Q_, value = Value, Q_1:Q_7)
view(data2)
#Creating plot
p <- ggplot(data2, aes(Value, Q_, fill = factor(Response, levels = c("Extremely Traumatic", "Traumatic","Somewhat Traumatic", "Neutral", "Somewhat Not Traumatic", "Mostly Not Traumatic", "Not At All Traumatic")))) + geom_col(position="stack") +
labs(title = "A stacked bar plot showing participants ratings of 7 traumatic scenarios",
subtitle = "Scale Not Traumatic to Traumatic",
y = "Scenario", x = "Number of Participants", fill = "Response") +
scale_y_discrete(labels = c("Witnessed a stranger being raped",
"Watched a consensual pornographic film involving violence",
"Witnessed a friend have a panic attack",
"Witnessed maimed human corpes while working in a refugee camp",
"Witnessed a friend being beaten to death",
"Witnessed father beat mother until bloody",
"Watched a stranger being raped")) +
scale_fill_brewer(palette = "BuGn") +
theme(text = element_text(size = 7))
p
ggsave(here("figs", "myplot.png"))
## Saving 7 x 5 in image