---
title: Demonstrative Evidence and the Use of Algorithms in Jury Trials
short-title: Algorithms in Jury Trials # running title
author:
  - first: Rachel                 # first name
    first-init: R.              # initial of first name
    last: Rogers                  # last name
    marker: 1               # identifier for the affiliation
    email: rachel.rogers@huskers.unl.edu          # optional email address
    footnote-id: 1
  - first: Susan
    first-init: S.
    last: VanderPlas
    marker: 1
footnote:
  - content: Corresponding author
    type: corresp               # set type for the corresponding author
    id: 1
affiliation:
  - institution: University of Nebraska-Lincoln
    prefix: Department of Statistics        # optional
    country: United States of America
    marker: 1
classoption:
  - letterpaper    # or a4paper, etc.
  - inpress        # or review
preamble: |
  \usepackage{cleveref}
  \usepackage{tabu,booktabs}
  \usepackage{amsfonts,amsmath,amssymb,amsthm}
abstract: |
  We investigate how the use of bullet comparison algorithms and demonstrative evidence may affect juror perceptions of reliability, credibility, and understanding of expert witnesses and presented evidence. The use of statistical methods in forensic science is motivated by a lack of scientific validity and error rate issues present in many forensic analysis methods. We explore what our study says about how this type of forensic evidence is perceived in the courtroom – where individuals unfamiliar with advanced statistical methods are asked to evaluate results in order to assess guilt. In the course of our initial study, we found that individuals overwhelmingly provided high Likert scale ratings in reliability, credibility, and scientificity regardless of experimental condition. This discovery of scale compression - where responses are limited to a few values on a larger scale, despite experimental manipulations - limits statistical modeling but provides opportunities for new experimental manipulations which may improve future studies in this area.
keywords:
  - explainable machine learning
  - jury perception
bibliography: bibliography.bib
output: 
  jds.rmd::pdf_article:
    keep_tex: true
    latex_engine: xelatex
editor_options: 
  markdown: 
    wrap: sentence
---

```{r setup,echo=FALSE, message=FALSE, warning=FALSE}
options(tinytex.clean = FALSE)
# for reading in the data
library(readr) 

# for data cleaning
library(tidyr) 
library(plyr)
library(dplyr)

# for plotting/tables
library(ggplot2)
#library(ggblend)
library(patchwork)
library(gt)
library(reshape2)

# for statistical analysis
library(MASS)
library(VGAM)
library(emmeans)
library(mgcv)

knitr::opts_chunk$set(dpi = 300, echo = F, eval = T, message = F, warning=F, error = F, out.width = ".9\\textwidth")

# Reading in data
merged_results_allresponses<-read_csv("data/merged_results_clean.csv")

# Removing person who took notes for on the first page that did not correspond to their scenario number
merged_results_allresponses <-merged_results_allresponses %>% subset(clean_prints!=231)

# Removing those who did not pass the attention checks
merged_results <- merged_results_allresponses %>% filter(check1 =="9mm" & check2 == "Moderately reliable") %>% dplyr::rename("Algorithm"="algorithm", "Conclusion"="conclusion", "Picture"="picture")

# Ordering the Conclusion Variable
merged_results$Conclusion <-
  factor(merged_results$Conclusion,
         levels = c("NoMatch", "Inconclusive", "Match"),
         labels = c("Elimination", "Inconcl.", "Identification"))

# Reading in the demographic dataset
demographics <-
  read_csv("data/demographic_clean.csv")

```

# Supplementary Material {.unnumbered}

The Supplementary Material includes: (1) Statistical models and additional graphs for study questions; (2) Code for the creation of the survey app; (3) Survey data and testimony outline; (4) Source files for paper.

# Introduction

The prevailing belief in bullet comparison in the forensic sciences is that guns can leave individualizing marks on bullets when fired, which can be used to identify the gun [@pcast2016].
Current bullet matching methods rely on a subjective visual comparison of bullets completed by a forensic scientist in order to reach a conclusion [@nrc2009].
In order to improve upon the bullet matching method with increased scientific validity, @pcast2016 urged the development of objective methods of analysis.
These reports have spurred increased research, development, and assessment of statistical matching methods for firearms analysis, including [@hare2017; @vanderplas2020; @songDevelopmentBallisticsIdentification2012].

As these algorithms are developed and validated, it becomes more important to understand how they may impact the evidentiary process - how will jurors react to algorithms used to match bullets?

In this factorial study, we examine the effect of algorithm use and demonstrative evidence (photos and data visualizations) in jurors' perception of examiner testimony.
We assess the perception of the strength of evidence, guilt or innocence, examiner credibility, and the reliability and scientific validity of firearms examination.
This study is intended to lay the groundwork for the use of algorithmic firearms comparisons in court.
When presented with the same evidence, it is important to know whether or not images affect potential jurors' views on the reliability or credibility of the witness and the evidence that they present.

## Bullet Matching Algorithm

```{r signature, fig.cap= "Bullet signatures for two lands. The left image indicates two matching lands, while the right image indicates two non-matching lands.", out.width="49%", warning= FALSE, message= FALSE, echo= FALSE, fig.show="hold"}

library(knitr)
include_graphics("images/Match_Signatures.jpg")
include_graphics("images/NoMatch_Signatures.jpg")

```

```{r comparisongrid, fig.cap= "Comparison grids demonstrating various bullet comparisons. The top two images were from the same source, and were used as the test fire (left) and the algorithmic identification (right) in the sample testimony. The bottom two images are from different sources, and were used as the algorithmic elimination (left) and inconclusive (right) in the sample testimony.", out.width="49%", warning= FALSE, message= FALSE, echo= FALSE, fig.show="hold"}

include_graphics("images/Test_Fire_F526.jpg")
include_graphics("images/F526_Match_SingleGrid.jpg")
include_graphics("images/K995_NoMatch_SingleGrid.jpg")
include_graphics("images/Q774_Inconclusive_SingleGrid.jpg")


```

The motivating idea of bullet matching is that there are unique scratches in a gun barrel resulting from the rifling process that make it possible to identify whether two bullets were fired from the same gun [@nrc2009].
This barrel rifling creates a spiral of raised areas, known as lands, and indented areas, known as grooves; these lands leave scratch marks on the bullet that can then be compared using an algorithm [@hare2017].
The transition period between lands and grooves of the bullet are known as shoulders [@hare2017].

Firearms examiners visually examine the lands of bullets using a comparison microscope, which allows two bullets to be directly compared in the same viewfinder.
If there is sufficient similarity (which is a subjective conclusion), the examiner will make an **identification**, suggesting that the two bullets are from the same source (SS) - they were fired from the same gun.
If there is sufficient dissimilarity (again, a subjective decision), the examiner will make an **elimination**, concluding that the bullets were not fired from the same gun.
If there is insufficient evidence in either direction (at least in theory, see [@inconclusives]), then the examiner will return an **inconclusive** decision.
The bullet matching algorithm developed by @hare2017 follows these steps: first, a 3D scan is taken of each bullet land, a stable cross-section is extracted, and shoulders (edges) are removed; then a smoothing function is applied twice in order to extract a representative profile, called the signature, which can be compared to signatures from other bullets (as shown in \Cref{fig:signature}); finally, traits derived from the signature are combined using a random forest classifier to produce a match score for each land, ranging in value from 0 to 1, where 0 is indicative of a different-source pair and 1 is indicative of a same-source pair.
There are multiple lands per bullet, resulting in a grid of land-to-land match scores when comparing two bullets, as shown in \Cref{fig:comparisongrid}.
Lands are ordered sequentially, so that bullets from the same source should produce high land-to-land match scores as the land number progresses [@vanderplas2020].
For example, in the top left grid of \Cref{fig:comparisongrid}, Land 5 (L5) of B1 corresponds to Land 1 (L1) of B2, as can be seen by the higher random forest score.
As the bullets are rotated, the lands continue to correspond (Land 6 of B1 to Land 2 of B2, and so forth) in a diagonal - indicating that the bullets match.


\begin{table}
\caption{\label{tab:matchtab}Match Score and Examiner Conclusion Language Used for Algorithm Evidence in the Sample Testimony}
\centering
\begin{tabu}{p{0.2\textwidth}p{0.2\textwidth}p{0.6\textwidth}}
\toprule
Bullet Comparison & Match Score & Language\\
\midrule
Test Fire & 0.976 & \\\\
Identification & 0.989 & The match score indicates that there is substantial similarity between the two bullets, which suggests that they were most likely fired from the same barrel.\\\\
Elimination & 0.034 & The match score indicates that there is significant disagreement between the two bullets.\\\\
Inconclusive & 0.34 & The match score indicates that there is not sufficient agreement between the two bullets, which suggests that the results are inconclusive.\\
\bottomrule
\end{tabu}
\end{table}


These individual scores for the maximum correspondence between the two bullets are averaged to create a bullet-level match score [@vanderplas2020].
The match scores reported in the sample testimony for the corresponding image in \Cref{fig:comparisongrid} are shown in \Cref{tab:matchtab}.
@vanderplas2020 validated the algorithm for use with guns outside models used in the training data.
This is a critical step required before the algorithm could be used in forensic labs.
For the algorithm to be used in practice, though, we must understand how jurors without statistical expertise understand and interpret the results from the algorithm when these results are presented during testimony.
This problem of jury interpretation of statistical results has been encountered before, in disciplines such as DNA and fingerprints [@koehler2001; @garrett2018].

## Explainable Machine Learning in Courts

@swofford2022 interviewed judges, lawyers, scientists, and researchers in order to assess their feelings about the use of statistical methods and probabilistic language in court.
They found that some individuals were concerned about jurors' ability to understand and properly interpret probabilistic language; some suggested that a mix of probabilistic language and match language may be more beneficial than strictly using one or the other.

FRStat (Friction Ridge Statistics), an analysis program which assigns statistical values to fingerprint analyses, uses likelihood ratios to characterize strength of evidence, with phrasing like "The probability of observing this amount of correspondence is approximately [X] times greater when the impressions are made by the same source rather than by different sources" [@DFSCLPInformation2018].
@garrett2018 found that jurors did not provide significantly different likelihoods that the individual was the source of the prints when they were presented with a wide range of FRStat likelihood results, ranging from values of 10 times greater to 100,000 times greater.

In another study, @koehler2001 investigated the perception of probabilities and frequencies in the case of DNA.
They found that individuals were more likely to believe the subject was the source of the DNA when the same number was presented as a probability rather than a frequency.
They also asked individuals to identify the number of people that would match DNA for their given match proportion in a population of 500,000; 60.7% of those given a frequency and 42.1% of those given a probability were able to correctly identify the number.
These examples illustrate that there is (justifiable) concern for how statistical methods and results may be presented and interpreted in the courtroom.
In the application of @hare2017's algorithm, the correspondence between bullets is described as a match score produced by a random forest, with values between 0 and 1.
This machine learning application may add another hurdle in juror understanding.

## Demonstrative Evidence

Demonstrative evidence, such as images, can serve as an aid in explaining results and methods used in the forensic sciences.
However, there is the potential that the use of images can be biasing.
In a study conducted by @cardwell2016, researchers found that topically related images may make a scenario more believable, even if the images provide no additional evidentiary value.
Individuals were asked to 'give' food to animals represented as words, then were later presented with animals (either as words or accompanied with an image) and asked to identify if they had given food to the animal [@cardwell2016].
Participants were more likely to believe that they had given food to the animal if it was accompanied with an image, regardless of whether or not they had actually given food [@cardwell2016].
Alternatively, In a series of studies asking jurors to evaluate the mental state of the defendant at the time of the crime, @schweitzer2011 found no effect of non-informative neuroimages on jurors' judgements.

In the courtroom, @kellermann describes the use of non probative images to elicit responses from juries in the form of "truthiness" (feelings that a statement is true) or "falsiness" (feelings that a statement is false), without introducing additional information through the images.
As statistical graphics can improve our ability to understand data and model results, it is possible that the use of explanatory images may increase jurors' ability to understand the use of algorithms for evaluating forensic evidence.
These graphics differ from those in @cardwell2016 as they are directly showing evidence that is also being presented and explained verbally.
Despite these differences, it is still possible that these images may influence potential jurors' perceptions of the speaker, or their feelings of "truthiness" in the case.

# Methods

## Participants

Participants were recruited using Prolific, an online platform for scientific research.
Prolific offers researchers the ability to obtain a representative sample of participants from a specific region (in this case, the United States) across age, race, and gender.
Individuals were additionally asked to self-screen for jury eligibility (no past felony convictions, over the age of majority, not emergency response personnel, etc.).
Participants were paid \$8.40 for their participation in the study and completed the study with a median response time of around 18 minutes.

## Online Jury Studies

While every attempt was made to use a representative sample in this study, there are certain unavoidable biases that are present in online jury research [@garrett2020], particularly when transcripts are used in place of videos.
Individuals who participate in Prolific surveys may not be representative of eligible jurors in the United States.
These individuals also do not undergo the jury selection process, and the jury selection process does not provide a representative sample of individuals in the United States [@abramson2018].
In order to provide a study of reasonable length, testimony was limited to the relevant firearms evidence, excluding other witnesses and evidence that may have been presented in a real trial.
Finally, jurors are unable to deliberate as a group; this may result in different conclusions than would be reached under the group dynamic present in deliberation [@bornsteinJuryDecisionMaking2011; @maccounAsymmetricInfluenceMock1988].
While acknowledging the limitations of this study format, it is important to note that research on actual jury pools is nearly impossible to conduct for many different logistical and practical reasons, including privacy, cost, and access; even if these barriers were overcome in one jurisdiction, the results from that jurisdiction would not be nationally representative or even representative beyond the sampling area.
Thus, online jury studies are an important tool to understand the effect of different manipulations of courtroom procedures, instructions, and admissible evidence.

## Design

In order to assess the effect of evidence presentation and the use of algorithms on how jurors evaluated firearms evidence, we developed a factorial experiment, manipulating the examiner's conclusion (identification, inconclusive, or elimination), whether algorithm testimony was included, and whether testimony included demonstrative evidence (pictures and charts), for a $3\times 2\times 2$ factorial experiment.
Participants were randomly assigned to one of the twelve experimental conditions.


\begin{table}
\caption{\label{tab:contab}Conclusion Language Used in the Firearms Examiner Testimony}
\centering
\begin{tabu} to \linewidth {l>{\raggedright}X}
\toprule
Conclusion & Language\\
\midrule
Identification & I found that there were sufficient individualizing characteristics to make an identification, that is, that the two bullets were fired from the same barrel.\\\\
Inconclusive & I found that the class characteristics of the two bullets were the same, but there was not sufficient agreement among the individual characteristics. My comparison was inconclusive.\\\\
Elimination & I found that there was significant disagreement in individual characteristics.\\
\bottomrule
\end{tabu}
\end{table}


Participants were presented with a trial scenario either with or without the use of a bullet matching algorithm.
When the algorithm was absent, participants were provided with testimony from a bullet comparison conducted by a firearms examiner, including the comparison of two test fires from the questioned gun in order to establish a baseline.
The wording of the examiner's conclusion is shown in \Cref{tab:contab}.
When the algorithm was present, participants read the same firearms examiner testimony, with an additional algorithmic comparison of the bullets (which supported the firearms examiner's conclusion).
In the transcript, the firearms examiner explained their training in the bullet matching algorithm as well as that the algorithm produces a score between 0 and 1 (0.976 for the test fires from the gun, 0.034 for the elimination condition, 0.34 for the inconclusive condition, and 0.989 for the identification condition).
The transcript then shows the examiner's interpretation of the algorithm results in reference to their own conclusion, as shown in \Cref{tab:matchtab}.
Following the firearms examiner's testimony, the transcript provided testimony from an individual involved in the development of the algorithm, describing the algorithm's process and limitations.
This is consistent with the way DNA comparison algorithms were presented before these algorithms were ubiquitous: a representative from the company providing the algorithm would testify about its development. 
Similar situations often arise when investigators make use of algorithms for triangulating a phone's location or linking posts made under different accounts to the same person.
Once an algorithm's use becomes commonplace, the algorithm expert is often not required to testify, but our goal was to assess the initial stage of the use of a bullet matching algorithm in practice.

In demonstrative evidence conditions, images demonstrating barrel rifling [@105mmTank2005], a fired bullet [@gremi], and a comparison microscope with striation marks were included in the testimony.
When both demonstrative evidence and the algorithm were used, the testimony also included an image of the land-to-land comparison grids.
Grids generated by the algorithm were shown for test fires, which were fired from the same gun, and should result in an identification, and for the questioned bullet comparison, reflecting the conclusion of the firearms examiner, as shown in \Cref{fig:comparisongrid}.
The testimony of the algorithm expert included images of the initial cross section scan with lines indicating shoulder removal [@hare2017], and signature comparison for matching and non-matching bullet lands, show in \Cref{fig:signature}.
Presented algorithm match scores and demonstrative evidence were derived from bullet scans which were evaluated by trained firearms examiners as part of an unpublished study, to ensure that the additional information presented was properly calibrated to the design scenario.

## Study Format

Participants were asked to read a short excerpt of court testimony with regards to an attempted robbery -- a scenario based on @garrett2020.
In this case, the only evidence linking the defendant, Richard Cole, to the crime scene is a comparison between a gun found in the car and a bullet recovered from the crime scene.
The transcripts were based on testimony given in real trials, as were our edits creating language about algorithms and quantitative evidence.
In order to facilitate participants' recall and provide insight into the portions of the testimony participants found to be important, participants were provided with a way to take notes throughout the presentation of testimony, as jurors are allowed to take notes during the trial for use as a memory aid during deliberation.
At the end of the transcript(s), participants were asked to rate their impression of the evidence presented, as well as their impression of the expert witnesses using Likert scales.
The survey was created using R Shiny [@shiny].
\Cref{fig:screenshot} depicts a screenshot of the study description.

```{=tex}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{images/descript_screenshot.jpg}\caption{Screenshot of the study description on the first page of the Shiny app.}\label{fig:screenshot}
\end{figure}
```
# Results

Five hundred and ninety-one participants completed the survey; of these, 569 correctly answered both attention check questions, identifying the caliber of the gun used in the crime and selecting a response indicated by the question text.
The attention check questions were present to ensure that online participants were reading the testimony as well as the questions before selecting answers.
All 569 participants correctly answering both attention check questions were included in the analyses reported below.
The number of participants for each of the 12 conditions is shown in \Cref{tab:contottab}, and demographic information is shown in \Cref{tab:ethnicitytab}.

```{r contottab, eval=TRUE, echo=FALSE, fig.align="center", message=FALSE}
dcast(merged_results, Algorithm+Picture~Conclusion) %>% kable(caption="Number of Participants per Condition")
```

```{r ethnicitytab, eval=TRUE, echo=FALSE, fig.align="center", message=FALSE}

prolific_demographics  <- read_csv("data/Survey App Demographic Data.csv")

approved_demo <-prolific_demographics %>% filter(Status =="APPROVED")

approved_demo$`Ethnicity simplified` <-replace(approved_demo$`Ethnicity simplified`, approved_demo$`Ethnicity simplified`=="DATA_EXPIRED", "Unknown")

table(approved_demo$`Ethnicity simplified`) %>% 
  as.data.frame() %>% dplyr::rename(Ethnicity = Var1, Count = Freq) %>%
  kable(caption="Number of Participants based on Ethnicity")

```

The average age of participants was `r round(mean(as.numeric(approved_demo$Age), na.rm=TRUE),2)` with a standard deviation of `r round(sd(as.numeric(approved_demo$Age),na.rm=TRUE),2)`.
`r sum(approved_demo$Sex=="Male")` participants identified as male, while `r sum(approved_demo$Sex=="Female")` identified as female, with `r sum(approved_demo$Sex=="DATA_EXPIRED")` unknown.

\begin{table}
\caption{\label{tab:questtab}Likert Scale Questions asked of Study Participants}
\centering
\begin{tabu}{p{0.1\textwidth}p{0.8\textwidth}}
\toprule
Condition & Question\\
\midrule
All & How strong would you say the case against the defendant is?\\\\
All & How strong is the evidence that the defendant's gun was used to fire the shot in the convenience store, in your opinion?\\\\
All & How credible did you find the testimony of Terry Smith (the firearm examiner)?\\\\
Algorithm & How credible did you find the testimony of Adrian Jones (the algorithm expert)?\\\\
Algorithm & How reliable do you think the firearm evidence in this case is?\\\\
All & How reliable do you think the firearm examiner's subjective opinion of the bullet comparison evidence is, in this case?\\\\
Algorithm & How reliable do you think the firearm algorithm evidence is,  in this case?\\\\
All & How scientific do you think the firearm examiner's subjective opinion of the bullet comparison evidence is, in this case?\\\\
Algorithm & How scientific do you think the firearm evidence is in this case, overall?\\\\
Algorithm & How scientific do you think the firearm algorithm evidence is in this case?\\\\
All & Based on this testimony, how would you rate your understanding of the method described for the examiner's personal bullet comparison?\\\\
Algorithm & Based on this testimony, how would you rate your understanding of the method described for the bullet matching algorithm?\\\\
All & How often do firearm examiners make mistakes when determining whether bullets were fired through the same gun?\\\\
All & In general, how reliable do you think firearm evidence is?\\\\
All & In general, how scientific do you think firearm evidence is?\\
\bottomrule
\end{tabu}
\end{table}

\Cref{tab:questtab} summarizes the Likert scale questions asked of participants.
Participants were asked to rate the following according to a 7-point Likert scale: their views on the examiner's credibility as well as the evidence's reliability and scientificity (eg. "extremely unreliable" to "extremely reliable").
When the algorithm was absent, participants were asked to rate the reliability and scientificity of the examiner's firearm comparison and the field of firearm comparison as a whole.
When the algorithm was present, participants were additionally asked to judge the reliability of the algorithm comparison and the overall firearm comparison (including both the algorithm and the examiner's comparison) in addition to the examiner's firearm comparison and the field of firearm comparison as a whole.

Strength of evidence (e.g. how much evidence there was to suggest the defendant was innocent or guilty) was measured on a 9-point Likert scale.

## Scale Compression

```{r reliablecompression, fig.cap= "Histogram of perceived reliability of the exmaminer's firearm comparison across all study conditions. There is evidence of significant scale compression across conditions, suggesting that in order to be able to measure  and statistically model differences in perception of examiner reliability, the transcripts must contain more information which might cause participants to question the reliability of the examiner and of firearms comparisons.", fig.width= 7, fig.height= 3, out.width=".9\\textwidth", fig.align= "center", cache = F}

# Ordering Likert scale
merged_results$examrel = factor(
  merged_results$examrel,
  levels = c(
    "Extremely unreliable",
    "Moderately unreliable",
    "Weakly unreliable",
    "Neither reliable nor unreliable",
    "Weakly reliable",
    "Moderately reliable",
    "Extremely reliable"
  )
)

# Creating line breaks
levels(merged_results$examrel) <-
  gsub(" ", "\n", levels(merged_results$examrel))

#Plotting
ggplot(subset(merged_results,!is.na(examrel)),
       aes(x = examrel)) +
  geom_bar(mapping = aes(y = ..prop.., group = 1)) +
  ggtitle("How reliable do you think the firearms examiner\'s subjective opinion \n of the bullet comparison evidence is, in this case?") +
  theme_bw()+
  ylab("Proportion")+
  theme(axis.title.x = element_blank())

```

Throughout this analysis, likert-style responses commonly display **scale compression** - most of the participants' responses fall into one or two bins at one extreme of the scale.
This suggests that the scenario itself is not calibrated to be able to detect changes in participant views.
Scale compression may occur in quantitative responses if, for example, an exam designed to assess student learning results in a class average of 95: the test is not designed to be able to separate the students who understand the material extremely well from the students who have only partially mastered the material.
Our participants generally found that the examiner was credible and that the evidence presented was reliable and scientific.
This compression is demonstrated in \Cref{fig:reliablecompression}, which shows participant selection for reliability categories of the examiner's comparison across all experimental conditions.
Here, the vast majority of participants chose the top two categories (`r sum(merged_results$examrel=="Extremely\nreliable" | merged_results$examrel=="Moderately\nreliable")` out of `r sum(!is.na(merged_results$examrel))`, or `r round(100*(sum(merged_results$examrel=="Extremely\nreliable" | merged_results$examrel=="Moderately\nreliable")/sum(!is.na(merged_results$examrel))),2)`%).
The other Likert categories have few observations - making it difficult to conduct comparisons across experimental conditions.
This lack of variation in responses makes it difficult to use standard statistical approaches, such as linear models.
In this paper, we use graphics to explore the data from this study in order to develop testable hypotheses for future iterations of studies using the Cole scenario.
In general, we primarily see strong effects when examining questions relating the examiner's conclusion (Identification/Match, Inconclusive, Elimination/Non match) to the likelihood that the gun was used in the crime or that the defendant was guilty.
This suggests that at the bare minimum, the scenario is well calibrated to assess the relationship between the examiner conclusion and the guilt or innocence of the suspect.

While we used a scenario which had been previously used in similar experiments [@garrett2018] and modified it to examine the use of algorithms, the original authors of this scenario are not statisticians and did not fully identify the underlying issues that may have contributed to an inability to detect differences between treatment groups in the original experiment.
It is important to design and calibrate these types of user experiments so that presented evidence is "just right" - not too strong, not too weak.
This calibration allows any manipulations, such as those in this study, to show up in the resulting data.
When scale compression is present, however, it is hard to show increased confidence in the examiner's opinion when the base assessment is already at "extremely reliable".
Thus, future iterations of this study need to do more to challenge the examiner's reliability and the perceived scientificity of the discipline - not because these things are necessarily in question (though there have been several successful legal challenges on the use of firearms evidence in court), but because in order to understand the effects of external manipulations, it is important to set up an experiment where these effects can be measured.
Inclusion of jury instructions (reminding the jury that they are the triers of fact and must be convinced beyond a reasonable doubt) and stronger cross-examination which focuses on error rates of firearms examination and examples of false convictions related to firearms may help to reduce scale compression and provide a more nuanced view of the effect of other interventions.

## Credibility

All participants (regardless of experimental condition) were asked to rate the credibility of the firearms examiner; results are provided in \Cref{fig:credible}.
`r sum(merged_results$firetestcred=="Extremely credible"| merged_results$firetestcred=="Moderately credible")` individuals selected "moderately credible" and "extremely credible" in the scale, while `r sum(!(merged_results$firetestcred=="Extremely credible"| merged_results$firetestcred=="Moderately credible"))` individuals selecting lower categories.

In addition, participants who were assigned to the algorithm condition were asked to rate the credibility of the algorithm expert.
These results also show scale compression: `r sum(merged_results$algtestcred=="Extremely credible"| merged_results$algtestcred=="Moderately credible", na.rm=TRUE)` chose "extremely credible" or "moderately credible" and `r sum(!(merged_results$algtestcred=="Extremely credible"| merged_results$algtestcred=="Moderately credible"), na.rm=TRUE)` chose a lower category.

```{r credible, fig.cap= "Histogram of examiner credibility by conclusion, demonstrative evidence, and algorithm conditions. Inconclusive conclusions have slightly lower credibility (particularly in the absence of demonstrative evidence), but overall, the primary observation when considering this data is that there is significant scale compression.", fig.width= 8, fig.height= 4, fig.align= "center", warning= FALSE, message= FALSE, echo= FALSE}


# Ordering the Likert scale
merged_results$firetestcred = factor(
  merged_results$firetestcred,
  levels = c(
    "Extremely noncredible",
    "Moderately noncredible",
    "Weakly noncredible",
    "Neither credible nor noncredible",
    "Weakly credible",
    "Moderately credible",
    "Extremely credible"
  )
)

# Creating line breaks in the Likert scale
levels(merged_results$firetestcred) <-
  gsub(" ", "\n", levels(merged_results$firetestcred))

# Credibility plot
# ggplot(subset(merged_results,!is.na(firetestcred)),
#          aes(x = firetestcred, fill = Conclusion)) +
#   geom_bar(
#     mapping = aes(y =after_stat(prop), group = Conclusion),
#     position = position_dodge(preserve = "single"), color="black"
#   ) +
#   facet_grid(Algorithm*Picture ~ ., labeller =  purrr::partial(label_both, sep = ":")) +
#   ggtitle("How credible did you find the testimony of Terry Smith (the firearm examiner)?") +
#   scale_fill_manual(values = c("#FF8E00", "grey20", "#037AC7")) +
#   theme_bw()+
#   ylab("Proportion")+
#   theme(axis.title.x = element_blank(), legend.position = c(0, 1), legend.justification = c(0, 1), legend.direction = "horizontal", legend.background = element_rect(fill = "transparent"))
# 
merged_results %>% 
  filter(!is.na(firetestcred)) %>%
  group_by(Conclusion, Algorithm, Picture, firetestcred) %>%
  count() %>%
  group_by(Conclusion, Algorithm, Picture) %>%
  mutate(prop = n/sum(n)) %>%
ggplot(aes(x = Picture, fill = firetestcred)) +
  geom_col(
    mapping = aes(y =prop),
    position = position_stack(), color="black"
  ) +
  coord_flip() +
  facet_grid(Algorithm~Conclusion, labeller = label_both) +
  ggtitle("How credible did you find the testimony of Terry Smith (the firearm examiner)?") +
  scale_fill_manual("", values = c("#8c510a", "#d8b365", "#f6e8c3", "#f5f5f5", "#c7eae5","#5ab4ac", "#01665e")) +
  theme_bw()+
  theme(legend.position = "bottom", legend.direction = "horizontal") + 
  ylab("Proportion of responses") + 
    guides(fill = guide_legend(nrow = 1, reverse = TRUE))
```

## Reliability

\Cref{fig:reliable} displays the results for the perception of firearm reliability as a field; a question that was also asked of all participants.
This chart is similar to the graphic for credibility in that the top two categories ("moderately reliable" and "extremely reliable") contain many of the responses (`r sum(merged_results$firerel=="Extremely reliable" | merged_results$firerel=="Moderately reliable")` observations), while other lower categories are sparsely populated (`r sum(!(merged_results$firerel=="Extremely reliable" | merged_results$firerel=="Moderately reliable"))` observations).
In this case, however, there is some correlation between the conclusion and the ratings of reliability - specifically, both in the presence and absence of the algorithm, "moderately reliable" was more popular than "extremely reliable" for inconclusive decisions (for a cumulative total of `r sum(merged_results$firerel=="Moderately reliable" & merged_results$Conclusion=="Inconcl.")` and `r sum(merged_results$firerel=="Extremely reliable" & merged_results$Conclusion=="Inconcl.")` observations, respectively).
This is the opposite of the trend seen in the elimination and identification conditions, where "moderately reliable" contains similar or less observations than "extremely reliable" (`r sum(merged_results$firerel=="Moderately reliable" & merged_results$Conclusion=="Elimination")` and `r sum(merged_results$firerel=="Extremely reliable" & merged_results$Conclusion=="Elimination")` respectively in the elimination condition; `r sum(merged_results$firerel=="Moderately reliable" & merged_results$Conclusion=="Identification")` and `r sum(merged_results$firerel=="Extremely reliable" & merged_results$Conclusion=="Identification")` respectively in the identification condition).

```{r reliable, fig.cap= "Perception of reliability of the field of firearms examination when manipulating demonstrative evidence (pictures) and use of the algorithm. Participants who read testimony about the algorithm were slightly more likely to say the field was moderately reliable and less likely to say the field was extremely reliable. Similarly, demonstrative evidence may be associated with a small reduction in perception of the reliability of the field.", fig.width= 7, fig.height= 4, out.width = "\\linewidth", fig.align= "center", echo= FALSE, message= FALSE, warning= FALSE}

# Ordering Likert scale
merged_results$firerel = factor(
  merged_results$firerel,
  levels = c(
    "Extremely unreliable",
    "Moderately unreliable",
    "Weakly unreliable",
    "Neither reliable nor unreliable",
    "Weakly reliable",
    "Moderately reliable",
    "Extremely reliable"
  )
)

# Creating line breaks
levels(merged_results$firerel) <-
  gsub(" ", "\n", levels(merged_results$firerel))

# #Plotting
# ggplot(subset(merged_results,!is.na(firerel)),
#        aes(x = firerel, fill = Conclusion)) +
#   geom_bar(
#     mapping = aes(y = after_stat(prop), group = Conclusion),
#     position = position_dodge(preserve = "single"), color="black"
#   ) +
#   facet_grid(Algorithm*Picture ~ ., labeller = label_both) +
#   ggtitle("In general, how reliable do you think firearm evidence is?") +
#   scale_fill_manual(values = c("#FF8E00", "grey20", "#037AC7")) +
#   theme_bw()+
#   ylab("Proportion")+
#   theme(axis.title.x = element_blank(), legend.position = c(0, 1), legend.justification = c(0, 1), legend.direction = "horizontal", legend.background = element_rect(fill = "transparent"))
# 

#Plotting
merged_results %>% 
  filter(!is.na(firerel)) %>%
  group_by(Conclusion, Algorithm, Picture, firerel) %>%
  count() %>%
  group_by(Conclusion, Algorithm, Picture) %>%
  mutate(prop = n/sum(n)) %>%
ggplot(aes(x = Picture, fill = firerel)) +
  geom_col(
    mapping = aes(y =prop),
    position = position_stack(), color="black"
  ) +
  coord_flip() + 
  facet_grid(Algorithm~Conclusion, labeller = label_both) +
  ggtitle("In general, how reliable do you think firearm evidence is?") +
  scale_fill_manual("", values = c("#d77227", "#fc8d59", "#fee090", "#ffffbf", "#e0f3f8","#91bfdb", "#4575b4")) +
  theme_bw()+
  theme(legend.position = "bottom", legend.direction = "horizontal") + 
  ylab("Proportion of responses") + 
    guides(fill = guide_legend(nrow = 1, reverse = TRUE))

```

## Scientificity

\Cref{fig:science} shows the opinion of the scientificity of the examiner's comparison, divided by algorithm condition.
As before, most responses are at the high end of the scale, with `r sum(merged_results$examsci=="Extremely scientific" | merged_results$examsci=="Moderately scientific")` observations in the two highest categories, and `r sum(!(merged_results$examsci=="Extremely scientific" | merged_results$examsci=="Moderately scientific"))` observations in the remaining categories.
When evaluating the top two categories of scientificity, the inconclusive category demonstrates a different trend than the other categories when the algorithm is present.
While other categories either favor "extremely scientific" over "moderately scientific" or have approximately equal results, when the algorithm is present and there is an inconclusive decision, participants tended toward "moderately scientific" over "extremely scientific" (`r sum(grepl("Moderately.scientific", merged_results$examsci) & grepl("Inconcl", merged_results$Conclusion) & merged_results$Algorithm=="Yes")` observations and `r sum(grepl("Extremely.scientific", merged_results$examsci) & grepl("Inconcl", merged_results$Conclusion)& merged_results$Algorithm=="Yes")` observations, respectively).

```{r science, fig.cap= "Perceived scientificity of the examiner's opinion by examiner conclusion, use of demonstrative evidence, and use of the algorithm. There are relatively few differences in perceived scientificity of the examiner's opinion across conditions, though inconclusive opinions seem to reduce perceptions of scientificity in the presence of the algorithm.", fig.width= 7, fig.height= 4, out.width="\\linewidth", fig.align= "center", echo= FALSE, message= FALSE, warning= FALSE}


# Ordering Likert scale
merged_results$examsci = factor(
  merged_results$examsci,
  levels = c(
    "Extremely unscientific",
    "Moderately unscientific",
    "Weakly unscientific",
    "Neither scientific nor unscientific",
    "Weakly scientific",
    "Moderately scientific",
    "Extremely scientific"
  )
)

# Creating line breaks
levels(merged_results$examsci) <-
  gsub(" ", "\n", levels(merged_results$examsci))

# Plotting
# ggplot(subset(merged_results,!is.na(examsci)),
#        aes(x = examsci, fill = Algorithm)) +
#   geom_bar(
#     mapping = aes(y = ..prop.., group = Algorithm),
#     position = position_dodge(preserve = "single"), color="black"
#   ) +
#   facet_grid(Conclusion ~ ., labeller =  purrr::partial(label_both, sep = ":\n")) +
#   ggtitle(
#     "How scientific do you think the firearms examiner\'s subjective opinion \n of the bullet comparison evidence is, in this case?"
#   ) +
#   scale_fill_manual(values = c("grey20", "tomato")) +
#   theme_bw()+
#   ylab("Proportion")+
#   theme(axis.title.x = element_blank(), legend.position = c(0, 1), legend.justification = c(0, 1), legend.direction = "horizontal", legend.background = element_rect(fill = "transparent"))

merged_results %>% 
  filter(!is.na(examsci)) %>%
  group_by(Conclusion, Algorithm, Picture, examsci) %>%
  count() %>%
  group_by(Conclusion, Algorithm, Picture) %>%
  mutate(prop = n/sum(n)) %>%
ggplot(aes(x = Picture, fill = examsci)) +
  geom_col(
    mapping = aes(y =prop),
    position = position_stack(), color="black"
  ) +
  coord_flip() + 
  facet_grid(Algorithm~Conclusion, labeller = label_both) +
  ggtitle("How scientific do you think the firearms examiner\'s subjective opinion \n of the bullet comparison evidence is, in this case?") +
  scale_fill_manual("", values = c("#b35806", "#f1a340", "#fee0b6", "#f7f7f7", "#d8daeb","#998ec3", "#542788")) +
  theme_bw() + 
  theme(legend.position = "bottom", legend.direction = "horizontal") + 
  ylab("Proportion of responses") + 
    guides(fill = guide_legend(nrow = 1, reverse = TRUE))

```

## Understanding

```{r histunder, fig.cap= "For the algorithm condition, participant understanding of algorithm and examiner testimony by conclusion and picture inclusion. Across conditions, participants were less confident in their understanding of the algorithm testimony compared to the examiner testimony.", out.width = "\\textwidth", fig.width= 7, fig.height= 4, fig.align= "center", echo= FALSE, message= FALSE, warning= FALSE}
# # Creating table of algorithm understanding and conclusion
# algunder_table<-table(merged_results$algunder, merged_results$Conclusion)
# algunder_df<-data.frame(algunder_table, Question="Algorithm")
# colnames(algunder_df)[2] <- "Conclusion"
# 
# # Creating table of examiner understanding (when the algorithm is present) and conclusion
# expunder_table<-table(merged_results[merged_results$Algorithm=="Yes",]$expunder,merged_results[merged_results$Algorithm=="Yes",]$Conclusion)
# expunder_df<- data.frame(expunder_table, Question="Examiner")
# colnames(expunder_df)[2] <- "Conclusion"
# 
# 
# under_df<-rbind(algunder_df, expunder_df)
# 
# under_df <- under_df %>%
#   group_by(Conclusion, Picture, Question) %>%
#   mutate(total = sum(Freq),
#          Proportion = Freq/total)
# 
# # Cleaning up the understanding label
# levels(under_df$Var1) <-
#   gsub("<br/>", "", levels(under_df$Var1))
# 
# levels(under_df$Var1) <-
#   gsub("  ", " ", levels(under_df$Var1))
# 
# 
# levels(under_df$Var1) <- gsub(" ", "\n", levels(under_df$Var1))

# plotting
# ggplot(under_df, aes(Var1, Proportion, fill=Question))+
#   geom_bar(stat="identity", position=position_dodge(preserve = "single"), color="black")+
#   ggtitle("Based on this testimony, how would you rate your understanding of the method
#                   described for the ______?") +
#   scale_fill_manual(values = c("gray", "black")) +
#   facet_grid(Conclusion~., labeller =  purrr::partial(label_both, sep = ":\n")) +
#   theme_bw()+
#   theme(axis.title.x = element_blank(), legend.position = c(0, 1), legend.justification = c(0, 1), legend.direction = "horizontal", legend.background = element_rect(fill = "transparent"))+ 
#   scale_x_discrete(labels=c('1\nI\nunderstood\nnothing', '2', '3', '4', '5\nI\nunderstood\neverything'))


histunderdata <- merged_results %>%
  pivot_longer(c(algunder, expunder), names_to = "Question", values_to = "Understanding") %>%
  mutate(Question = stringr::str_replace_all(Question, c("algunder" = "Algorithm", "expunder" = "Examiner"))) %>%
  filter(!(Question =="Algorithm" & Algorithm == "No")) %>%
  group_by(Conclusion, Picture, Question, Algorithm, Understanding) %>%
  count() %>%
  group_by(Conclusion, Picture, Question, Algorithm) %>%
  mutate(prop = n/sum(n)) %>%
  mutate(Understanding = stringr::str_remove(Understanding, "<br/>|.0") %>%
           stringr::str_remove(., "I understood "))
histunderdata %>%
  filter(Algorithm == "Yes") %>%
ggplot(aes(x = Question, fill = Understanding)) + 
  geom_col(aes(y = prop), position = "stack", color = "black") + 
  facet_grid(Picture~Conclusion, labeller = "label_both") + 
  coord_flip() + 
  scale_fill_manual("I understood", values = c("#d01c8b", "#f1b6da", "#f7f7f7", "#b8e186", "#4dac26")) + 
  theme_bw() + 
  ylab("Proportion") +
  theme(legend.position = "bottom", legend.direction = "horizontal") + 
  ylab("Proportion of responses") + 
  guides(fill = guide_legend(nrow = 1, reverse = TRUE))

highest_cats_alg <- sum(filter(histunderdata, Algorithm == "Yes" & Question == "Algorithm" & stringr::str_detect(Understanding, "[345]"))$n)
lowest_cats_alg <- sum(filter(histunderdata, Algorithm == "Yes" & Question == "Algorithm" & !stringr::str_detect(Understanding, "[345]"))$n)
highest_cats_exam <- sum(filter(histunderdata, Algorithm == "Yes" & Question == "Examiner" & stringr::str_detect(Understanding, "[345]"))$n)
lowest_cats_exam <- sum(filter(histunderdata, Algorithm == "Yes" & Question == "Examiner" & !stringr::str_detect(Understanding, "[345]"))$n)
```

```{r undertab, eval=TRUE, echo=FALSE, fig.align="center"}

histunderdata %>%
  filter(Algorithm == "Yes") %>%
  group_by(Question, Conclusion, Understanding) %>%
  summarize(n = sum(n)) %>%
  pivot_wider(names_from = Understanding, values_from = n, values_fill = 0) %>%
  magrittr::set_names(c("Question", "Conclusion", as.character(1:5))) %>% 
  kable(caption="Table of participant understanding for participants in the algorithm condition, where 1 corresponds to understanding nothing and 5 corresponds to understanding everything.")
```

Participants were asked to rate their understanding of the firearms examiner's comparison, as well as their understanding of the algorithm (when present).
These results are shown in \Cref{fig:histunder} and \Cref{tab:undertab} for those given the algorithm condition - comparing their rated understanding of the firearms examiner's comparison and the algorithm comparison when both are present.
Here, individuals mostly selected the three highest categories (`r highest_cats_alg` vs `r lowest_cats_alg` for the understanding of the algorithm and `r highest_cats_exam` vs `r lowest_cats_exam` for the understanding of the forensics examiner's comparison), and there appears to be a difference in participants' rating of the algorithm and examiner when the algorithm is present.
The algorithm was generally assigned lower values of understanding than the examiner.
It should be noted that participants' rating of their own understanding may not truly indicate the understanding of the participants.
@dunningFlawedSelfAssessmentImplications2004 found that an individual's rating of their own knowledge may not directly correspond to their actual learning level.
\Cref{fig:underalgexp} shows the perceived understanding of the firearms examiner's comparison across all categories.

```{r underalgexp, fig.cap= "Histogram of perceived understanding of the firearms examiner's bullet comparison", fig.width= 7, fig.height= 4, out.width = "\\textwidth", fig.align= "center", echo= FALSE, message= FALSE, warning= FALSE}
# merged_results$expunder <- gsub(" ", "\n", merged_results$expunder)
# merged_results$expunder <- gsub("<br/>", "", merged_results$expunder)
merged_results <- merged_results %>%
  mutate(expunder = stringr::str_remove(expunder, "<br/>") %>%
           stringr::str_remove("\\n") %>%
           stringr::str_remove("I understood ") %>%
           stringr::str_remove("\\.0") %>%
           stringr::str_replace("\\s{2,}", " "))

merged_results %>%
  filter(!is.na(expunder)) %>%
  group_by(Conclusion, Algorithm, Picture, expunder) %>%
  count() %>%
  group_by(Conclusion, Algorithm, Picture) %>%
  mutate(prop = n/sum(n)) %>%
  ggplot(aes(x = Picture, fill = expunder)) + 
  geom_col(aes(y = prop, position = "stack"),  color="black") + 
  coord_flip() + 
  scale_fill_manual("I understood", values = c("#d01c8b", "#f1b6da", "#f7f7f7", "#b8e186", "#4dac26")) + 
  theme_bw() + 
  theme(legend.position = "bottom", legend.direction = "horizontal") + 
  ylab("Proportion of responses") + 
  guides(fill = guide_legend(nrow = 1, reverse = TRUE)) + 
  facet_grid(Algorithm ~ Conclusion, labeller = label_both)
#Plotting
# ggplot(subset(merged_results,!is.na(expunder)),
#        aes(x = expunder, fill = Conclusion)) +
#   geom_bar(
#     mapping = aes(y = after_stat(prop), group = Conclusion),
#     position = position_dodge(preserve = "single"), color="black"
#   ) +
#   facet_grid(Algorithm*Picture ~ ., labeller = label_both) +
#   ggtitle("Based on this testimony, how would you rate your understanding of the method
#                   described for the firearms examiner?") +
#   scale_fill_manual(values = c("#FF8E00", "grey20", "#037AC7")) +
#   theme_bw()+
#   ylab("Proportion")+
#   theme(axis.title.x = element_blank(), legend.position = c(0, 1), legend.justification = c(0, 1), legend.direction = "horizontal", legend.background = element_rect(fill = "transparent"))

```

## Probability

```{r prob, fig.cap= "Probability the gun was used in the crime, or that Cole committed the crime. Dashed lines indicate bullet match scores for the algorithm. Participants were less committed to Cole's guilt or innocence than to the gun's involvement (or not) in the crime across all conditions, suggesting that at least some participants correctly discerned that the gun was not necessarily an indication of Cole's involvement, e.g. that the evidence linking him to the crime was circumstantial.", fig.width = 7, fig.height = 4,  out.width= "\\textwidth", fig.align= "center", echo= FALSE, eval= TRUE, warning= FALSE, message= FALSE, dev='png'}


# Putting gun probability and defendant probability in a single column
merged_probcombine<- merged_results %>% 
  dplyr::select(Algorithm, gunprob, Conclusion, probability) %>%
  pivot_longer(cols=c(gunprob, probability), names_to = "Type", values_to="Probability")

merged_probcombine$Type <- factor(merged_probcombine$Type, levels = c("probability", "gunprob"), 
                  labels = c("Cole", "Gun"))

alg_score <- data.frame(Conclusion = c("Elimination", "Inconcl.", "Identification"), Probability = c(3.4, 34, 98.9)) %>%
  mutate(Conclusion = factor(Conclusion, levels = c("Elimination", "Inconcl.", "Identification"), ordered = T))

ggplot(merged_probcombine, aes(x = Probability, fill = Algorithm, color = Algorithm)) +
  geom_density(alpha = 0.25)+ #|> partition(vars(Algorithm)) |> blend("multiply") +
  geom_vline(data = alg_score, aes(xintercept = Probability), inherit.aes = F, linetype = "dashed") +
  ggtitle("Probability __ was Involved in/Committed the Crime") +
  facet_grid(Type ~ Conclusion, labeller = label_both) +
  scale_fill_manual(values = c("grey20", "tomato"))+
  scale_color_manual(values = c("grey20", "tomato"))+
  theme_bw()+
  theme(legend.position = c(.68, 1), legend.justification = c(0, 1),legend.background = element_rect(fill = "transparent"))

```

Linear models are used for questions regarding the probability that Cole committed the crime and the probability that the gun was used in the crime.
These probabilities are modeled with a beta generalized linear model that considers the interaction between conditions; results can be found in the supplementary material.
\Cref{fig:prob} displays participant reported probabilities that Cole committed the crime or Cole's gun was involved in the crime.
This figure indicates that there is a difference between conclusions (as expected, due to differences in the strength of evidence presented), but not much of a difference for cases when the algorithm is included.
Here, in the case of an elimination, probabilities assigned by participants appear to be extremely low, while in the case of an identification, probabilities appear to be relatively high.
In the case of an inconclusive decision, participants also tended to favor a lower probability, although this trend is not as extreme as in the case of an elimination.
Because bullet match scores, resulting from the use of the algorithm, range from 0 to 1, there was concern that participants may incorrectly interpret this value as the probability of involvement in the crime.
The vertical lines in \Cref{fig:prob} indicate this match score for each condition.
There does not appear to be evidence that those who received the algorithm condition anchored to the match score values, when comparing the distribution of those who did not receive the match score (the non-algorithm condition).

```{r probpic, fig.cap= "Probability the gun was used in the crime, or that Cole committed the crime.", out.width= "400px", fig.align= "center", echo= FALSE, eval= FALSE, warning= FALSE, message= FALSE, dev='png'}


# Putting gun probability and defendant probability in a single column
merged_probcombine<- merged_results %>% 
  dplyr::select(Picture, gunprob, Conclusion, probability) %>%
  pivot_longer(cols=c(gunprob, probability), names_to = "Type", values_to="Probability")

merged_probcombine$Type <- factor(merged_probcombine$Type, levels = c("probability", "gunprob"), 
                  labels = c("Cole", "Gun"))

ggplot(merged_probcombine, aes(x = Probability, fill = Picture)) +
  geom_density(alpha = 0.55, color=NA)+ #|> partition(vars(Picture)) |> blend("multiply") +
  ggtitle("Probability __ was Involved in/Committed the Crime") +
  facet_grid(Type ~ Conclusion, labeller = label_both) +
  scale_fill_manual(values = c("darkmagenta", "yellow"))+
  theme_bw()

```

```{r probguilt, fig.cap= "Probability that Cole committed the crime (black) and that the gun was used in the crime (pink) based on whether the participants chose to convict. Overall, participants responded to the testimony presented (Identification, Inconclusive, Elimination) in a reasonable manner. The largest discrepancy between probabilities for Cole and probabilities for the gun was in Identification; that is, many participants recognized that information about the gun's use (or not) in the crime may not provide the same level of information about Cole's guilt or innocence.", fig.width= 7, fig.height= 4, out.width = "\\textwidth", fig.align= "center", echo= FALSE, eval= TRUE, warning= FALSE, message= FALSE}

merged_results %>%
  pivot_longer(c(probability, gunprob), names_to = "Reference", values_to = "Probability") %>%
  mutate(Reference = stringr::str_replace_all(Reference, c("probability" = "Cole", "gunprob" = "Gun"))) %>%
  ggplot(aes(x = guilty, y = Probability, fill = Reference)) + 
  geom_boxplot(position = position_dodge(1),
               alpha = 0.15,
               outlier.shape = NA) +  
  geom_point(
    aes(color = Reference),
    position = position_jitterdodge(
      jitter.width = 0.2,
      jitter.height = 0.4,
      dodge.width = 1
    ),
    size = 0.5
  ) +
  scale_fill_manual(values = c("grey20", "#d01c8b"), name="")+
  scale_color_manual(values = c("grey20", "#d01c8b"), name="")+
  facet_grid(.~Conclusion) + 
  theme_bw() +   
  ggtitle("Probability ___ was involved in the Crime") +
  ylab("Probability") + 
  xlab("Convict?") + 
  theme(legend.position = c(1, 0), legend.justification = c(1,0), legend.title = element_blank(), legend.background = element_rect(fill = "transparent"))
  
# 
# probplot <-
#   ggplot(merged_results, aes(x = Conclusion, y = probability, fill = guilty)) +
#   geom_point(
#     position = position_jitterdodge(
#       jitter.width = 0.2,
#       jitter.height = 0.4,
#       dodge.width = 1
#     ),
#     size = 0.5
#   ) +
#   geom_boxplot(position = position_dodge(1),
#                alpha = 0.5,
#                outlier.shape = NA) +
#   ggtitle("Probability Cole\nCommited the Crime") +
#   ylab("Probability")+
#   scale_fill_manual(values = c("grey20", "plum1"), name="Convict?")+
#   theme_bw()+
#   theme(legend.position = "none")
# 
# gunplot <-
#   ggplot(merged_results, aes(x = Conclusion, y = gunprob, fill = guilty)) +
#   geom_point(
#     position = position_jitterdodge(
#       jitter.width = 0.2,
#       jitter.height = 0.4,
#       dodge.width = 1
#     ),
#     size = 0.5
#   ) +
#   geom_boxplot(position = position_dodge(1),
#                alpha = 0.5,
#                outlier.shape = NA) +
#   ggtitle("Probability Gun\nwas used in the Crime") +
#   ylab("Probability")+
#   scale_fill_manual(values = c("grey20", "plum1"), name="Convict?")+
#   theme_bw()
# 
# probplot + gunplot

```

Participants were also asked whether or not they would choose to convict Cole, based on the criminal trial standard of "beyond a reasonable doubt".
The conviction decision of participants and their assigned probabilities of involvement in the crime are shown in \Cref{fig:probguilt}, grouped by the conclusion of the firearms examiner.
10 out of 196 (5%) who received the elimination condition, 13 out of 191 (7%) who received the inconclusive decision, and 112 out of 182 (62%) who received the identification condition chose to convict.
The few individuals who chose to convict in the elimination and inconclusive conditions assigned higher probabilities than their counterparts, indicating that individuals thought Cole was guilty or that the gun was used in the crime.
This discrepancy between conclusion and participant selections may be due to faulty internal logic, or a general belief that someone whose case has proceeded to trial is unlikely to be innocent, regardless of the evidence.
When the examiner made an identification, participants who chose to convict assigned higher probabilities that Cole committed the crime than those who did not convict.
The choice to not convict in the identification condition may be due to the "beyond a reasonable doubt" threshold: the only evidence that participants read matched the gun to the crime scene, but did not have evidence that tied Cole specifically to the crime.
This distinction between the gun and Cole can be seen in the relationship between those who chose not to convict when the bullets matched in \Cref{fig:probguilt}: they overall assigned a higher probability that gun was used in the crime than they did that Cole was involved in the crime (mean values of `r round(mean(merged_results[merged_results$Conclusion=="Identification" & merged_results$guilty=="No",]$gunprob), 2)` and `r round(mean(merged_results[merged_results$Conclusion=="Identification" & merged_results$guilty=="No",]$probability),2)` with standard deviations of `r round(sd(merged_results[merged_results$Conclusion=="Identification" & merged_results$guilty=="No",]$gunprob), 2)` and `r round(sd(merged_results[merged_results$Conclusion=="Identification" & merged_results$guilty=="No",]$probability),2)`, respectively).

## Summary

A common feature in many of these charts is scale compression - most individuals limited their Likert scale selection to the two highest values in terms of credibility, reliability, and scientificity.
This demonstrates that, across all experimental conditions, participants perceive the examiner as credible, and the evidence as reliable and scientific.
In this study, we were unable to discern a difference in perception of reliability, credibility, or scientificity between the algorithm and non-algorithm conditions or between demonstrative evidence and standard testimony conditions, though there are suggestions that effects may be present but not detectable due to scale compression (e.g. \Cref{fig:underalgexp}).
Feelings regarding the strength of evidence, conviction decision, and probability Cole/the gun was involved in the crime varied by the conclusion of the firearms examiner, as expected.

The examiner's conclusion had the largest effect, both in the expected areas of strength of evidence and probability that Cole/the gun was involved in the crime, as well as in areas of reliability and scientificity.
There was also some difference between perceptions of the algorithm and the traditional bullet analysis method.
In particular, the explanation of the algorithm received lower scores of understanding than the explanation of the firearms examiner's bullet comparison.
This may be due to math aversion - terms used in the algorithm description sound difficult to understand, which may reduce the willingness of participants to try to parse the explanation, even if the explanation itself is not technical.

# Discussion

In this study, questions using Likert scales were frequently subject to scale compression, complicating our attempts to statistically model responses by condition.
There are several solutions to this problem, but one of the most promising is to alter the scenario to introduce more doubt about the process of firearms examination, shifting participant answers towards the middle of the Likert scale.
Introducing discussion of erroneous convictions due to firearms evidence, adding more information about error rates in firearms examination, and including instructions to the jury from the judge before the examiner's testimony are all options which have occurred in real court cases and which would be expected to reduce scale compression and improve the statistical ability to discern effects of algorithms and demonstrative evidence on interpretation of firearms testimony.

Another solution is to move away from Likert scales to responses in different formats: probabilities, numerical chance, betting, and opinion of guilt.
We are in the process of executing a short follow-up study which examines different ways to ask these questions, and our goal is to explore not only how participant responses change, but to also demonstrate ways to model these different response types effectively.

Very few studies are executed perfectly; this study is no exception.
There were two minor mistakes in the transcript which were present for approximately the first half of participants.
These typos included referring to the firearms expert as Alex Smith as opposed to Terry Smith in all scenario questions, and for the cross examination in the elimination testimony.
In the case of non-algorithm inconclusive testimonies, the question: "Can you describe the process of obtaining these test fired bullets?" was missing, but the response: "The test-fired bullets came from a test fire of the gun recovered from the traffic stop." remained unchanged.
There was no indication that participants were confused by these typos, but because Prolific recruits participants for separate demographic categories, these typos are confounded with the demographic variables, because blocks for demographics with higher participation on Prolific (younger ages, whites) fill up more quickly than blocks with lower participation on the site.

In addition to the data-driven modifications above, we also noticed during the execution of this study that participants may not have fully understood the difference between initial testimony and cross examination, or which witnesses were testifying for the prosecution vs. the defense.
The transcript format provided in this study followed the same format as the court transcripts - speakers were indicated by "Q:" and "A:", but the identity of the speaker and their alignment within the courtroom could be easily confused.
To address this, we plan to implement a more visual representation of a courtroom transcript, using graphics to show each individual who is speaking and subtle cues to indicate which side they are testifying for.

We expect that these combined modifications will produce a study with more nuanced participant responses and will alleviate the scale compression seen in this experiment.

# Acknowledgements

Thank you to the study participants, without whom this work would not be possible.

This work was funded (or partially funded) by the Center for Statistics and Applications in Forensic Evidence (CSAFE) through Cooperative Agreements 70NANB15H176 and 70NANB20H019 between NIST and Iowa State University, which includes activities carried out at Carnegie Mellon University, Duke University, University of California Irvine, University of Virginia, West Virginia University, University of Pennsylvania, Swarthmore College and University of Nebraska, Lincoln.

Computation and visualizations were made possible thanks to the following R packages: 'tidyverse'[@tidyverse], 'RColorBrewer' [@colorbrewer], 'patchwork' [@patchwork], 'gt' [@gt], 'MASS' [@mass], 'emmeans' [@means], 'shiny' [@shiny], and 'mgcv' [@mgcv].
