https://gitlab.uzh.ch/giva/geovisense/cosit2022_analyses.git
Raw File
Tip revision: eb44c295d5acbec85e9786d5967313abee90c554 authored by Armand Kapaj on 09 August 2022, 15:13:58 UTC
remove
Tip revision: eb44c29
COSIT22_Analyses.Rmd
---
title: "Signal Detection Theory Analysis - COSIT 2022"
author: "Armand Kapaj"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output: 
  html_document:
    code_download: yes
    code_folding: show
    df_print: paged
    font_adjustment: 1
    theme: readable
    toc: yes
    toc_depth: 4
    toc_float:
      collapsed: no
  word_document:
    toc: yes
    toc_depth: '4'
  pdf_document:
    toc: yes
    toc_depth: '4'
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE)
library(dplyr)
library(psycho)
library(tidyr)
library(lme4)
library(lmerTest)
library(ggplot2)
library(ggpubr)
library(pastecs)
library(patchwork)
```

# Introduction
We conducetd a real-world navigation task and were interested in assessing **how landmark visualization style (3D abstract vs. 3D realistic) might influence participants' landmark and route knowledge acquisition. We expect participants to recall landmarks and route directions better when navigating with realistic 3D landmarks than with abstract 3D landmarks.** 

After arriving at the destination, participants completed a questionnaire designed to assess their landmark and route knowledge. The landmark and route questionnaire presented 30 images in random order, with ten images each for **1) relevant** , **2) irrelevant**, and **3) novel** landmarks as seen from participants’ perspective during navigation. Relevant landmarks (**REL**) refer to landmarks that participants saw along the route that were located where a navigation decision was required, and which were presented as either 3D realistic or 3D abstract on the mobile map. Irrelevant landmarks (**IRL**) refer to buildings located along the route that were not depicted on the mobile map and where no navigation decision was required (i.e., participants continued straight when passing an IR). Novel landmarks (**NOL**) were buildings in a similar style to the buildings within the study area that were neither along the route nor visualized on the map.

To assess the effect of landmark visualization style on wayfinders’ acquired landmark knowledge, we employed analyses according to **Signal Detection Theory (SDT)**. **SDT** distinguishes response accuracy (i.e., stimulus, signal, or target) from background noise or distractors. **SDT** encodes participants’ correct responses as **“Hit”** or **“Correct Rejection”**, and false responses are recorded as **“Miss”** or **“False Alarm”**.

# Encode groups

I created two datasets corresponding to the IDs of participants that start with either the landmarks visualized as **abstract** or **realistic** 3D building models.

````{r data conditions and color}
abst <- c(3,4,6,11,14,15,17,18,19,20,23,25, 26,27,28,30,31,32,33,36,39,42,44) # Set the ID of participants that start with the abstract condition
real <- c(1,2,5,7,8,9,10,12,13,16,21,22,24,29,34,35,37,38,40,41,43,45,47) # Set the ID of participants that start with the realistic condition

plotcolors <- c("abstract 3D" = "#f1a340", "realistic 3D" = "#998ec3") #colors variable for the graphs preparation
````

# Dprime level one - landmarks seen in the environment
## Load and preprocess *seen* data

Loading and preprocessing the data for the first question: *Did you see this building during your trip?*.
I used the **Signal Detection Theory (SDT)** principles to code the data. Therefore, if the landmark is REL or IRL and participants answered that they saw it we encoded it as a **hit**, and if they didn't saw them that is a **miss**. If its NOL landmark and participants answered that they saw it, that is a **false alarm**, and a **correct rejection** if they replied that they did not see it.


````{r data seen}
lmkt_seen <- read.csv("data/LMKT_LM.csv")%>%
  gather(LM, LMResponse, lm_1:no_30, factor_key = T)%>% # Convert data from wide to long and store them into two new columns [LM and LMresponse]
  separate(LM, c("LM_Type", "LM"), "_")%>% #split lm column
  separate(ID, c("ID_TypeI", "ID"), 2)%>% #split the id column
  separate(ID, c("ID", "Extra"), 2)%>% #further split the id column
  select(-ID_TypeI, -Extra)%>% #remove unecessary columns from the dataset
  mutate(LM = as.numeric(LM), #recode columns as having numeric characters
         ID = as.numeric(ID),
         Condition = ifelse(ID %in% real & LM < 6, "realistic 3D",  #code data to separate participants in conditions [1 = realistic, and 0 = abstract] and also code the data for SDT analyses
                     ifelse(ID %in% abst & LM > 5 & LM < 11, "realistic 3D",
                     ifelse(ID %in% real & LM > 20 & LM < 26, "realistic 3D",
                     ifelse(ID %in% abst & LM > 25, "realistic 3D", 
                     ifelse(ID %in% real & LM > 10 & LM < 16, "realistic 3D",
                     ifelse(ID %in% abst & LM > 15 & LM < 21, "realistic 3D", "abstract 3D")))))),
         Is_CorrectSeen_Hit = ifelse(LM_Type == "lm" & LMResponse == "yes", 1,
                              ifelse(LM_Type == "ir" & LMResponse == "yes", 1, 0)),
         Is_CorrectSeen_FA  = ifelse(LM_Type == "no" & LMResponse == "yes", 1, 0))%>%
  
  group_by(ID, Condition)%>%
  summarise(Is_CorrectSeen_FA = sum(Is_CorrectSeen_FA, na.rm = T),
            Is_CorrectSeen_Hit = sum(Is_CorrectSeen_Hit, na.rm = T))%>%
  mutate(CorrectHitPerc = abs(Is_CorrectSeen_Hit/10)*100,
         CorrectFAPerc = abs(Is_CorrectSeen_FA/5)*100)
````

## Calculate seen dprime

Next we calculate the **dprime** score as the *difference of the Z score of the hit rate (recognition of seen landmarks) and that of false alarm (recognition of not seen landmarks)*.

```{r calculate seen dprime}
### dprime for correctly seen
n_hit = lmkt_seen$Is_CorrectSeen_Hit
n_fa = lmkt_seen$Is_CorrectSeen_FA
indices_seen <- psycho::dprime(
  n_hit = n_hit,
  n_fa = n_fa,
  n_miss = 10 - n_hit,
  n_cr = 5 - n_fa,
  n_targets = 10, #RE + IR landmarks per group
  n_distractors = 5, #Novel landmarks per group
  adjusted = T
)

dprime_seen <- cbind(lmkt_seen, indices_seen)
```

## Dprime seen plots


````{r seen plots, echo=FALSE}
HIT_Seen<-ggplot(lmkt_seen, aes(x=Condition, y=CorrectHitPerc, fill = Condition, color = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", size = 1,position=position_dodge(0.7), show.legend = F) +
  geom_hline(yintercept = 0, size = 0.5) +
  theme_pubclean(base_size=11) +
  scale_color_manual(values = plotcolors,
                     aesthetics = c("color", "fill")) +
  theme(axis.text.x = element_blank(),
        axis.ticks.x = element_blank()) +
  labs(title="A. ",
       subtitle="",
       x="",
       y="Hit rate [%]") + ylim(0, 100)

FA_Seen<-ggplot(lmkt_seen, aes(x=Condition, y=CorrectFAPerc, fill = Condition, color = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", size = 1,position=position_dodge(0.7)) +
  geom_hline(yintercept = 0, size = 0.5) +
  theme_pubclean(base_size=11) +
  scale_color_manual(values = plotcolors,
                     aesthetics = c("color", "fill")) +
  theme(axis.text.x = element_blank(),
        axis.ticks.x = element_blank(),
        legend.position = "bottom",
        legend.title = element_text(size = 8)) +
  labs(title="B.",
       subtitle="",
       x="",
       y="False alarm rate [%]",
       fill = "Landmark visualization style:", color = "Landmark visualization style:") + ylim(0, 100)

Seen_Plot <- ggplot(dprime_seen, aes(x=Condition, y=dprime, fill = Condition, color = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", size = 1,position=position_dodge(0.7), show.legend = F) +
  geom_hline(yintercept = 0, size = 0.5) +
  theme_pubclean(base_size=11) +
  scale_color_manual(values = plotcolors,
                     aesthetics = c("color", "fill")) +
  labs(title="C.",
       subtitle="",
       x="",
       y="Discriminability d’ (d prime)",
       color="")  + ylim(0, 3) +
  theme(axis.text.x = element_blank(),
        axis.ticks.x = element_blank())

HIT_Seen + FA_Seen + Seen_Plot

ggsave("plots/Seen_Plots.png", height=3.5, width=11.5)
````


## Dprime seen analyses

I used multilevel regression analyses to compare landmark knowledge performance between the groups. The equation models the effect of landmark visualization style on the landmark knowledge, while controlling for experimental condition.

````{r dprime seen analyses}
#first level dprime analyses (REL, IRL, NOL)
dprime_seen$Condition = as.factor(dprime_seen$Condition)

seen_model <- lmer(dprime ~ Condition + (1|ID), data=dprime_seen)
summary(seen_model)
sjPlot::tab_model(seen_model, digits.p = 2) #model results

seen_efect <- 0.04/sqrt(0.05 + 0.37)
seen_efect #effect size of dprime, r = 0.06
sprintf(seen_efect, fmt = "%#.2f")
#Effect size calculation of mixed effect models following: https://www.journalofcognition.org/articles/10.5334/joc.10/

by (dprime_seen$CorrectHitPerc, dprime_seen$Condition, stat.desc, basic = FALSE, norm = TRUE)
by (dprime_seen$CorrectFAPerc, dprime_seen$Condition, stat.desc, basic = FALSE, norm = TRUE)
by (dprime_seen$dprime, dprime_seen$Condition, stat.desc, basic = FALSE, norm = TRUE)
````

The percentage of hits (Plot A) indicates that the participants of the **realistic** group correctly identified *M = 67.4%, SE = 2.5%* of REL and IRL landmarks. While the **abstract** group correctly identified *M = 65%, SE = 2.9%*. We see that there is *no difference* between groups for the hit rate.

The percentage of false alarm (Plot B) indicates that there is no difference between the groups. Participants of the **realistic** group falsely identified *M = 20%, SE = 3.2%* of NOL landmarks as seen during the navigation task. While the **abstract** group falsely identified *M = 19.6%, SE = 2.9*. We see that there is *no difference* between groups for the false alarm rate either.

The results of the multilevel model indicate that the **realistic** group has a slightly higher dprime score (*M = 1.23, SE = 0.1*), compared to the **abstract** group (*M = 1.19, SE = 0.09*). However, *contrary to our hypothesis*, the difference between the groups is *not significant* (*p = 0.74*).


## Bias seen response model

````{r}
t.test(dprime_seen$c[dprime_seen$Condition == "abstract 3D"], mu = 0, alternative = "two.sided") #if the abstract 3D group participants bias is significantly higher than zero (no bias)

t.test(dprime_seen$c[dprime_seen$Condition == "realistic 3D"], mu = 0, alternative = "two.sided") #if the realistic 3D group participants bias is significantly higher than zero (no bias)

t.test(c ~ Condition, paired = T, data = dprime_seen) #checking the difference in response bias between conditions
````

We find that *participants’ response bias is significantly higher than zero for both conditions* (abstract 3D: *M = 0.19, t(45) = 2.8, p = 0.007*; realistic 3D: *M = 0.17, t(45) = 2.7, p = 0.009*), indicating that participants were more likely to respond that they did not see the landmark in the environment. The difference in response bias is not significant between conditions (*t(45) = 0.29, p = 0.77*).


Next we calculate if the dprime results are influenced by the hit rate.

````{r hit}
#If the dprime results are influenced by the hit rate
seen.hit <- lmer(CorrectHitPerc ~ Condition + (1|ID), dprime_seen)
summary(seen.hit)
sjPlot::tab_model(seen.hit, digits.p = 2) #model results

hit_seen_efect <- 2.39/sqrt(117.8 + 216)
hit_seen_efect #effect size of hit rate, r = 0.13
sprintf(hit_seen_efect, fmt = "%#.2f")
#Effect size calculation of mixed effect models following: https://www.journalofcognition.org/articles/10.5334/joc.10/
````

The answer is no (*p = 0.44*).

Next we calculate if the dprime results are influenced by the false alarm rate.

````{r fa}
#If the dprime results are influenced by the false alarms
seen.fa <- lmer(CorrectFAPerc ~ Condition + (1|ID), dprime_seen)
summary(seen.fa)
sjPlot::tab_model(seen.fa, digits.p = 2) #model results

fa_seen_efect <- 0.43/sqrt(26.7 + 404.4)
fa_seen_efect #effect size of hit rate, r = 0.02
sprintf(fa_seen_efect, fmt = "%#.2f")
#Effect size calculation of mixed effect models following: https://www.journalofcognition.org/articles/10.5334/joc.10/
````

The answer is no (*p = 0.92*).


# Dprime level two - Landmarks seen on the mobile map

## Load and preprocess *display* data

Loading and preprocessing the data for the second question: *Where do you remember seeing this building?*. We used this question to make the distinction between REL and IRL landmarks, and if the realistic landmarks (REL) visualized on the mobile map improve users' spatial learning. 

If the landmark is REL and participants answered that they saw it on the *map* we encoded it as a **hit**, and if they saw it only on the *environment* as a **miss**. If its IRL landmark and participants answered that they saw it on the *map*, that is a **false alarm**, and a **correct rejection** if they replied that they saw it only on the *environment*.

````{r data where}
lmkt_display <- read.csv("data/LMKT_Where.csv")%>%
  gather(LMWhere, WhereResponse, lm_1_where:no_30_where, factor_key = T)%>%
  separate(LMWhere, c("LM_Type", "LM_Number", "Where"), "_")%>%
  separate(ID, c("ID_TypeI", "ID"), 2)%>% #split the id column
  separate(ID, c("ID", "Extra"), 2)%>% #further split the id column
  select(-ID_TypeI, -Extra, -Where)%>%
  subset(LM_Type !="no")%>% #remove rows for the novel landmarks
  mutate(LM_Number = as.numeric(LM_Number), #recode columns as having numeric characters
         ID = as.numeric(ID),
         Condition = ifelse(ID %in% real & LM_Number < 6, "realistic 3D",  #code data to separate participants in conditions [1 = realistic, and 0 = abstract] and also code the data for SDT analyses
                     ifelse(ID %in% abst & LM_Number > 5 & LM_Number < 11, "realistic 3D",
                     ifelse(ID %in% real & LM_Number > 20 & LM_Number < 26, "realistic 3D",
                     ifelse(ID %in% abst & LM_Number > 25, "realistic 3D", 
                     ifelse(ID %in% real & LM_Number > 10 & LM_Number < 16, "realistic 3D",
                     ifelse(ID %in% abst & LM_Number > 15 & LM_Number < 21, "realistic 3D", "abstract 3D")))))),
         Is_CorrectDisplay_Hit = ifelse(LM_Type == "lm" & WhereResponse == "tablet",1, 0),
         Is_CorrectDisplay_FA =  ifelse(LM_Type == "ir" & WhereResponse == "tablet", 1, 0))%>%
  group_by(ID, Condition)%>%
  summarise(Is_CorrectDisplay_FA = sum(Is_CorrectDisplay_FA, na.rm = T),
            Is_CorrectDisplay_Hit = sum(Is_CorrectDisplay_Hit, na.rm = T))%>%
  mutate(CorrectHitPerc = abs(Is_CorrectDisplay_Hit/5)*100,
         CorrectFAPerc = abs(Is_CorrectDisplay_FA/5)*100)
````

## Calculate dispaly dprime

Next we calculate the **dprime** score as the *difference of the z score of the hit rate (recognition of landmarks visualized on the display) and that of false alarm (recognition of landmarks not visualized on the display)*.

```{r calculate display dprime}
n_hit = lmkt_display$Is_CorrectDisplay_Hit
n_fa = lmkt_display$Is_CorrectDisplay_FA
indices_display <- psycho::dprime(
  n_hit = n_hit,
  n_fa = n_fa,
  n_miss = 5 - n_hit,
  n_cr = 5 - n_fa,
  n_targets = 5, #the number of relevant landmarks per group
  n_distractors = 5, #the number of irrelevant landmarks per group
  adjusted = T
)

dprime_display <- cbind(lmkt_display, indices_display)
```

## Drpime display plots

````{r display plots, echo=FALSE}
HIT_Display <- ggplot(lmkt_display, aes(x=Condition, y=CorrectHitPerc, color=Condition)) +
  stat_summary(fun.data = "mean_cl_boot", size = 1,position=position_dodge(0.7), show.legend = F) +
  geom_hline(yintercept = 0, size = 0.5) +
  theme_pubclean(base_size=11) +
  scale_color_manual(values = plotcolors,
                     aesthetics = c("color", "fill")) +
  theme(axis.text.x = element_blank(),
        axis.ticks.x = element_blank()) +
  labs(title="A.",
       subtitle="",
       x="",
       y="Hit rate [%]",
       color="Condition")  + ylim(0, 100)

FA_Display <- ggplot(lmkt_display, aes(x=Condition, y=CorrectFAPerc, fill = Condition, color=Condition)) +
  stat_summary(fun.data = "mean_cl_boot", size = 1,position=position_dodge(0.7)) +
  geom_hline(yintercept = 0, size = 0.5) +
  theme_pubclean(base_size=11) +
  scale_color_manual(values = plotcolors,
                     aesthetics = c("color", "fill")) +
  theme(axis.text.x = element_blank(),
        axis.ticks.x = element_blank(),
        legend.position = "bottom",
        legend.title = element_text(size = 8)) +
  labs(title="B.",
       subtitle="",
       x="",
       y="False alarm rate [%]",
       color="Landmark visualization style:", fill = "Landmark visualization style:")  + ylim(0,100)

Display_Plot <- ggplot(dprime_display, aes(x=Condition, y=dprime, fill = Condition, color = Condition)) +
  stat_summary(fun.data = "mean_cl_boot", size = 1,position=position_dodge(0.7), show.legend = F) +
  geom_hline(yintercept = 0, size = 0.5) +
  theme_pubclean(base_size=11) +
  scale_color_manual(values = plotcolors,
                     aesthetics = c("color", "fill")) +
  labs(title="C.",
       subtitle="",
       x="",
       y="Discriminability d’ (d prime)",
       fill = "Condition: ", color = "Condition: ")  + ylim(0, 3) + 
  theme(axis.text.x = element_blank(),
        axis.ticks.x = element_blank(), legend.position = "bottom")

HIT_Display + FA_Display + Display_Plot

ggsave("plots/Display_Plots.png", height=3.5, width=11.5)
````


## Drpime display analyses

I used multilevel regression analyses to compare landmark knowledge performance between the groups. The equation models the effect of landmark visualization style on the knowledge of landmarks visualized on the mobile map display, while controlling for experimental condition.

````{r dprime display analyses}
#second level dprime analyses (RE, IR)
dprime_display$Condition = as.factor(dprime_display$Condition)

display_model <- lmer(dprime ~ Condition + (1|ID), data=dprime_display)
summary(display_model)
sjPlot::tab_model(display_model, digits.p = 2) #model results

display_efect <- 0.27/sqrt(0.34 + 0.24)
display_efect #effect size of hit rate, r = 0.4
sprintf(display_efect, fmt = "%#.1f")
#Effect size calculation of mixed effect models following: https://www.journalofcognition.org/articles/10.5334/joc.10/

by (dprime_display$CorrectHitPerc, dprime_display$Condition, stat.desc, basic = FALSE, norm = TRUE)
by (dprime_display$CorrectFAPerc, dprime_display$Condition, stat.desc, basic = FALSE, norm = TRUE)
by (dprime_display$dprime, dprime_display$Condition, stat.desc, basic = FALSE, norm = TRUE)
````

When participants use **3D realistic landmarks**, they have a *higher hit rate* (*M = 74.3%, SE = 3.5%}; Plot A*) and *lower false alarm rate* (*M = 5.7%, SE = 1.6%; Plot B*) on *recalling the landmarks visualized on the mobile map display* than when using *3D abstract* (*M = 66.5%, SE = 3.7%*, and *M = 8.3%, SE = 2.3%*, respectively) landmarks. *In line with our hypothesis*, the hit and false alarm rates led to *significant differences* (*p = 0.03*) between better detectability (Plot C) for the realistic 3D landmarks (*M = 1.81, SE = 0.1*) than the abstract 3D landmarks (*M = 1.54, SE = 0.1*).


## Bias display response model

````{r}
t.test(dprime_display$c[dprime_display$Condition == "abstract 3D"], mu = 0, alternative = "two.sided") #if the abstract 3D group participants bias is significantly higher than zero (no bias)

t.test(dprime_display$c[dprime_display$Condition == "realistic 3D"], mu = 0, alternative = "two.sided") #if the realistic 3D group participants bias is significantly higher than zero (no bias)

t.test(c ~ Condition, paired = T, data = dprime_display) #checking the difference in response bias between conditions
````

Results revealed that participants’ response bias is significantly higher than zero for both conditions (abstract 3D: *M = 0.35, t(45) = 6.02, p < 0.001*; realistic 3D: *M = 0.29, t(45) = 5.3, p < 0.001*), indicating that participants were more likely to respond that they did not see the landmark on the mobile map display. The difference for response bias between conditions is not significant (*t(45) = 0.93, p = 0.36*).

Next we calculate if the dprime results are influenced by the hit rate of correctly identified landmarks on the mobile map display.

````{r}
#If the dprime results are influenced by the hit rate
display.hit <- lmer(CorrectHitPerc ~ Condition + (1|ID), dprime_display)
summary(display.hit)
sjPlot::tab_model(display.hit, digits.p = 2) #model results

hit_display_efect <- 7.83/sqrt(377.6 + 224.3)
hit_display_efect #effect size of hit rate, r = 0.3
sprintf(hit_display_efect, fmt = "%#.1f")
````

The **realistic** group has higher hit rate (*7.83%*) compared to the **abstract group**. However, the difference is not significant (*p = 0.06*).

Next we calculate if the dprime results are influenced by the false alarm rate of falesly identified landmarks on the mobile map display.

````{r}
#If the dprime results are influenced by the false alarm
display.fa <- lmer(CorrectFAPerc ~ Condition + (1|ID), dprime_display)
summary(display.fa)
sjPlot::tab_model(display.fa, digits.p = 2) #model results

fa_display_efect <- -2.61/sqrt(76.71 + 103.19)
fa_display_efect #effect size of hit rate, r = -0.2
sprintf(fa_display_efect, fmt = "%#.1f")
````

The **realistic** group has lower false alarm rate (*2.61*) compared to the **abstract group**. However, the difference is not significant (*p = 0.22*).

# Route accuracy
## Load and preprocess route data

Loading and preprocessing the data for the third question: *Which direction did you go after seeing this building?*. We used this question to analyze the influence of landmark visualization style (*realistic vs. abstract*) on participants route knowledge. The participants could answer that they went **straight**, **turned left**, or **turned right** after seeing the landmarks.


````{r route data}
route <- read.csv("data/LMKT_Dir.csv")%>%
  gather(LM, LMDirection, lm_1_dir:no_30_dir, factor_key = T)%>% # Convert data from wide to long and store them into two new columns [LM and LMresponse]
  separate(LM, c("LM_Type", "LM"), "_")%>% #split lm column
  separate(ID, c("ID_TypeI", "ID"), 2)%>% #split the id column
  separate(ID, c("ID", "Extra"), 2)%>% #further split the id column
  select(-ID_TypeI, -Extra)%>% #remove unecessary columns from the dataset
  subset(LM_Type == "lm")%>%
  mutate(LM = as.numeric(LM), #recode columns as having numeric characters
         ID = as.numeric(ID),
         Condition = ifelse(ID %in% real & LM < 6, "realistic 3D",  #code data to separate participants in conditions [1 = realistic, and 0 = abstract] and also code the data for SDT analyses
                     ifelse(ID %in% abst & LM > 5 & LM < 11, "realistic 3D", "abstract 3D")),
         Is_CorrectDir = ifelse(LM == 1 & LMDirection == "right", 1,
                         ifelse(LM == 2 & LMDirection == "right", 1,
                         ifelse(LM == 7 & LMDirection == "right", 1,
                         ifelse(LM == 8 & LMDirection == "right", 1,
                         ifelse(LM == 10 & LMDirection == "right", 1,
                         ifelse(LM == 3 & LMDirection == "straight", 1,
                         ifelse(LM == 4 & LMDirection == "left", 1,
                         ifelse(LM == 5 & LMDirection == "left", 1,
                         ifelse(LM == 6 & LMDirection == "left", 1,
                         ifelse(LM == 9 & LMDirection == "left", 1,0)))))))))))%>%
  group_by(ID, Condition)%>%
  summarise(Is_CorrectDir = sum(Is_CorrectDir, na.rm = T))%>%
  mutate(CorrectDirPerc = abs(Is_CorrectDir/5)*100)
  
route$Condition = as.factor(route$Condition)
````
## Plot route accuracy

````{r plot route, echo = FALSE}
#modify the plots
h_line <- 33.3 #chance performance at 33.3%
Route_Accuracy <- ggplot(route, aes(x=Condition, y=CorrectDirPerc, color=Condition)) +
  stat_summary(fun.data = "mean_cl_boot", size = 1,position=position_dodge(0.7)) +
  geom_hline(yintercept = h_line, size = 0.5, color = "#66c2a5") +
  geom_text(aes(0, h_line, label = "33.3%", vjust = -0.3, hjust = 0), color = "#66c2a5", size = 2.8) + 
  geom_hline(yintercept = 0, size = 0.4) +
  theme_pubclean(base_size=9) +
  scale_color_manual(values = plotcolors,
                     aesthetics = c("color", "fill")) +
  labs(title="",
       subtitle="",
       x="",
       y="Route direction accuracy [%]",
       color="Landmark visualization style:")  + ylim(0, 100) +
  theme(axis.text.x = element_blank(),
        axis.ticks.x = element_blank(), legend.position = "bottom")

Route_Accuracy
ggsave("plots/Route Accuracy.png", width=8, height=3)

````


## Route choice accuracy results

````{r route analyses}
t.test(route$CorrectDirPerc[route$Condition == "abstract 3D"], mu = 33.3, alternative = "two.sided")
t.test(route$CorrectDirPerc[route$Condition == "realistic 3D"], mu = 33.3, alternative = "two.sided")

route_model <- lmer(CorrectDirPerc ~ Condition + (1|ID), data=route)
summary(route_model)
sjPlot::tab_model(route_model, digits.p = 2) #model results

route_efect <- 7.39/sqrt(438.74 + 183.19)
route_efect #effect size of hit rate, r = -0.3
sprintf(route_efect, fmt = "%#.1f")
````

Finally, the analysis of route direction recall accuracy reveals that both groups performed significantly better (abstract 3D: *t(45) = 4.8, p < 0.001*; realistic 3D: *t(45) = 7.7, p < 0.001*) than *chance level (green line) at 33.3%* (three possible route directions: straight, left, and right).

The route direction choice accuracy plot shows that the **realistic group** (*M = 59.56%, SE = 3.4%*) *outperforms* the **abstract group** (*M = 52.17%, SE = 3.9%*) with *7.39%* more correct route directions. However, *contrary to our hypothesis*, this difference is not significant (*p = 0.09*).
back to top