\documentclass[a4paper,man,floatsintext,natbib]{apa6}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{apacite}

\usepackage{graphicx}
\usepackage{parskip}
\usepackage{url}
\usepackage{hhline}

\usepackage{natbib}

\usepackage{array}
\usepackage{makecell}
\usepackage{xcolor}

\usepackage{caption}

\include{macros}

\usepackage{xcolor}
\newcommand\todo[1]{\textcolor{red}{TODO: #1}}
\newcommand*{\Scale}[2][4]{\scalebox{#1}{$#2$}}%
\newcommand*{\Resize}[2]{\resizebox{#1}{!}{$#2$}}%
\renewcommand\theadalign{bc}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}

\usepackage{letltxmacro}
\LetLtxMacro{\oldalgorithmic}{\algorithmic}
\LetLtxMacro{\endoldalgorithmic}{\endalgorithmic}
\renewenvironment{algorithmic}[1][0]{%
  \hrulefill\par
  \oldalgorithmic[#1]}
                 {\endoldalgorithmic\par
                  \vspace*{-.5\baselineskip}
                  \hrulefill\par}


\usepackage{xcite}
\usepackage{xr}
\makeatletter
\newcommand*{\addFileDependency}[1]{% argument=file name and extension
  \typeout{(#1)}% latexmk will find this if $recorder=0 (however, in that case, it will ignore #1 if it is a .aux or .pdf file etc and it exists! if it doesn't exist, it will appear in the list of dependents regardless)
  \@addtofilelist{#1}% if you want it to appear in \listfiles, not really necessary and latexmk doesn't use this
  \IfFileExists{#1}{}{\typeout{No file #1.}}% latexmk will find this message if #1 doesn't exist (yet)
}
\makeatother

\newcommand*{\myexternaldocument}[1]{%
    \externaldocument{#1}%
    \addFileDependency{#1.tex}%
    \addFileDependency{#1.aux}%
}
%%% END HELPER CODE

% put all the external documents here!
\myexternaldocument{main}
\setcounter{equation}{3}
\begin{document}

\begin{titlepage}
   \begin{center}
       \vspace*{1cm}

       \textbf{Supplementary Electronic Materials for:\\Overcoming individual limitations through distributed computation}

    \end{center}
\end{titlepage}

\section{Model}

Here, we describe our Bayesian social sampling in detail and prove Equation \ref{eqn:main-result}.

\subsection{Environment Model}
We assume that the state of the environment which is to be inferred
by the population of learners can be represented as a binary feature
vector, $\bx$.  
Features are related to observed evidence via simple logical
relations. Observed pieces of
evidence are represented in $\bY$.  Evidence about the feature vector
arrives over time, so $\bY = (\by_1, \ldots, \by_T)$, where $T$ is the
time horizon.  We assume that at each time $t$, $J$ new pieces of evidence
about feature $i$ are available, $y_{ijt} \sim P_{i}$, where $P_{i}$ is
a distribution specific to feature $i$. We assume that $y_{ijt}$ are
independent, so $P_{i}$ is simply a component of a conditional
probability table, $P_{i} = P(y_{ijt} = 1 \g x_i = 0) = \theta_{i0}$
if $x_i = 0$ and $P_{i} = P(y_{ijt} = 1 \g x_i = 1) = \theta_{i1}$
if $x_i = 1$.  Under these assumptions, evidence is either
perceived as positive or negative, and pieces of evidence are
uncorrelated across time.% or in terms of other factors.

%%  For simplicity in
%% formulating our model we assume that every agent observes all evidence
%% available on each time step; we relax this assumption in our
%% experiments.

%% Each agent can either be ``decided'' or ``uncertain'' about a
%% particular feature.  When an agent is ``decided'', that agent either
%% believes the feature is true or false.  When the agent is
%% ``undecided'', the agent has no belief about that feature.

\subsection{Social Sampling}

To develop a normative model of
behavior in this environment, we specify an individual-level,
sample-based social heuristic that leads to population-rational, distributed
Bayesian inference in aggregate. Crucially, group computation can emerge even when the social learning heuristic is simple and easy to compute\textemdash population rationality does not require unbounded, perfectly rational individuals. Indeed, individuals rely on social information \emph{because of} the limited time and cognitive resources they have to make their decisions.

%The model is population-rational in that the behavior of a population of social samplers yields collective behavior that appears as if the group is itself a rational actor, even if the behavior of individuals in the group is simple or heuristic. 

Our model is specified at the level of the individual in that we seek an explanation in terms of the behavioral mechanisms of individual people, and is
sample-based as it relies on the assumption that people do not fully represent uncertainty in their
mental representations. Instead, we assume that people often think of the world as simply being one way or the other at a particular point in time. Formally, we let $N$ be the number of agents, $d_{ait}$ be a
discrete decision of agent $a$ about the value of feature $i$ at time
$t$, and $p_{it} = \frac{1}{N}\sum_{a} \1(d_{a,i,t-1} = 1)$ be
the proportion of agents who believe $x_i = 1$ at time $t-1$.
  $\theta_{i1}$,
$\theta_{i0}$, and $y_{ijt}$ are defined as in the environment model above. For notational convenience, we also let $S_{it} = \sum_{j = 1}^J \1(y_{ijt} = 1)$.

In our social sampling model, at each time step $t$ each agent $a$ uses a heuristic
decision-making rule: The agent starts out undecided, and continues to sample possible decisions until
decided. To sample a decision, agent $a$ samples an agent $a'$ who was
decided on the last time step uniformly at random, and considers the
choice of agent $a'$, $d_{a',i,t-1}$.  Agent $a$ then decides $d_{a',i,t-1}$ with probability proportional to
$(\theta_{i,d_{a',i,t-1}})^{S_{it}}(1 - \theta_{i,d_{a',i,t-1}})^{J - S_{it}}$,
which is the likelihood of the evidence that agent $a$ has at time $t$
under the state of the world indicated by agent $a'$. The number of samples agent $a$ takes is a geometric random variable
with parameter $p_{it} \cdot (\theta_{i1})^{nS_{it}}(1 -
\theta_{i1})^{J - S_{it}} + (1 - p_{it}) \cdot
(\theta_{i0})^{S_{it}}(1 - \theta_{i0})^{J - S_{it}}$, and is finite
with probability one.  


\subsection{Evidence Accumulation}
Because each iteration of the decision loop is independent, the probability of
$a$ deciding $d_{ait} = 1$ is 
\begin{equation}
\frac{(\theta_{i1})^{S_{it}}(1 -
  \theta_{i1})^{J - S_{it}} \cdot p_{it}}{(\theta_{i1})^{S_{it}}(1 -
  \theta_{i1})^{J - S_{it}} \cdot p_{it} + (\theta_{i0})^{S_{it}}(1 -
  \theta_{i0})^{J - S_{it}} \cdot (1 - p_{it})}.
\end{equation}
In an infinite population of agents, for a particular feature $i$, we
then have (by induction)
\begin{align*}
    p_{i,t+1}
    &=
      \frac{(\theta_{i1})^{S_{it}}(1 - \theta_{i1})^{J - S_{it}} \cdot p_{it}}{(\theta_{i1})^{S_{it}}(1 - \theta_{i1})^{J - S_{it}} \cdot p_{it} +  (\theta_{i0})^{S_{it}}(1 - \theta_{i0})^{J - S_{it}} \cdot (1 - p_{it})}
  \\
  &=
  \frac{P(\by_{i,\cdot,t} \g x_i = 1) \cdot p_{it}}{P(\by_{i,\cdot,t} \g x_i = 1) \cdot p_{it} + P(\by_{i,\cdot,t} \g x_i = 0) \cdot (1 - p_{it})}
  \\
  &=
  \frac{P(\by_{i,\cdot,t} \g x_i = 1) P(x_i = 1 \g \by_{i,\cdot,<t})}{P(\by_{i,\cdot,t} \g x_i = 1) P(x_i = 1 \g \by_{i,\cdot,<t}) + P(\by_{i,\cdot,t} \g x_i = 0) P(x_i = 0 \g \by_{i,\cdot,<t})}
  \\
  &=
  \frac{P(\by_{i,\cdot,\leq t} \g x_i = 1) P(x_i = 1)}{P(\by_{i,\cdot,\leq t})}
  \\
  &=
  P(x_i = 1 \g \by_{i,\cdot,\leq t})
\end{align*}

being the posterior distribution on $x$ given all preceding evidence.

\section{Model comparison}

We compared the performance of the Bayesian social sampling model with three alternative non-social models and two alternative social models. We assessed the fit of each model by comparing the aggregate popularity observed at each generation with the popularity predicted by the model.

\subsection{Non-social Probability Matching Models}

Our first two non-social models differentiate between pure probability matching and Bayesian probability matching.

\subsubsection{Non-social Probability Matching}

The non-social probability matching model describes decision-makers who make a feature categorization with probability equal to the evidence they have directly observed for that categorization being correct. In this case, the predicted popularity of a categorization is the fraction of positive evidence for that categorization in the current generation, $\frac{S_{it}}{J}$. If no evidence is observed, the predicted popularity of the categorization is zero.

\subsubsection{Non-social Bayesian Probability Matching}

The non-social Bayesian probability matching model describes decision-makers who make feature categorizations with probability equal to the posterior probability of the categorization being correct, given the evidence they have directly observed. The predicted popularity of a categorization is thus equal to the posterior probability for that categorization being correct given the evidence in the current generation, $P(x_{it} = 1 \g \by_{i,\cdot,t})$.

\subsection{Non-social Utility Maximizing}

Our third non-social comparison model describes individuals who follow a utility maximizing strategy based on only the evidence they have directly observed. A non-social utility maximizing agent makes a feature categorization if the posterior probability for that categorization is at least 0.5. In this case

\begin{equation}
    P(d_{ait} = 1)  = 
    \begin{cases}
        \ 1 & \text{if }  P(x_{it} = 1 \g \by_{i,\cdot,t}) > 0.5 \color{white}.\\
        \ 0 & \text{if } P(x_{it} = 1 \g \by_{i,\cdot,t}) < 0.5.\\
    \end{cases}
\end{equation}

That is, the predicted popularity of a categorization is 1 if the posterior for that categorization is 0.5 or higher, and 0 otherwise (ties are broken randomly).

\subsection{Naive Copying}

Our fourth comparison model describes a purely social decision-maker who copies the categorization of a previously observed agent. In this model, the first generation makes their choices uniformly at random, and the predicted popularity of a categorization decision $i$ at generation $t$ is equal to $p_{it}$, the popularity of decision $i$ at the previous generation.

\subsection{Social Sampling Models}
In addition to our hypothesized Bayesian social sampling model, we consider an alternative social sampling model that is based on pure probability matching. While both this model and the Bayesian social sampling model lead to information accumulation over time, the Bayesian social sampling model allows us to view transmission as distributed inference, offering a closer correspondence to the Bayesian approach to modeling individual cognition.

To fit both of these models, we first observed that a large proportion of participants in Experiment 1 ignored social information. To derive predictions from our social sampling models on Experiment 1, we therefore assumed that there is a mixture of non-social sampling using the corresponding probability matching model and social sampling. We let $p_{ns}$ be the proportion of non-social sampling.


\subsubsection{Social Sampling (Probability Matching)}

In the probability matching social sampling model, individuals iteratively sample decisions at random from the previous generation and accept or reject the components of those decisions based on the latest observed evidence. In this case, the acceptance probability is the same as the decision probability in the non-social probability matching model. The predicted popularity according to this combination of components is the previous popularity of the categorization times the fraction of most recent positive evidence, normalized by the previous unpopularity of the categorization decision times the most recent negative evidence. Introducing non-social agents into this model is equivalent to setting the prior popularity to the proportion of social agents times the previous popularity of the categorization plus a uniform prior times the proportion of non-social agents. The predicted popularity at each generation is thus
\begin{equation}
\frac{
\frac{S_{it}}{J}
\cdot ( p_{it} \cdot (1 - p_{ns}) + 
0.5\cdot p_{ns} )
}
{\frac{S_{it}}{J}
\cdot ( p_{it} \cdot (1 - p_{ns}) + 0.5\cdot p_{ns} ) + (1 - \frac{S_{it}}{J}) \cdot ( (1 - p_{it}) \cdot (1 - p_{ns})+ 0.5\cdot p_{ns} )}.
\end{equation}
In the edge case where the popularity of a decision is equal to one but its evidence is equal to zero, the estimated popularity is set to zero.

\subsubsection{Social Sampling (Bayesian)}

The Bayesian social sampling model is our primary hypothesized model that was previously described in detail. In this model, individuals iteratively sample decisions at random from the previous generation and accept or reject the components of those decisions based on the Bayesian likelihood of the categorization being correct given the latest evidence. In this model, the acceptance probability is proportional to the decision probability in the non-social Bayesian probability matching model. The predicted popularity according to this combination of components is the previous popularity of a categorization times the likelihood of the categorization being correct given the most recent evidence, normalized by the previous unpopularity of the categorization times the likelihood of the categorization being incorrect given the most recent evidence. Integrating non-social decision-makers into this model is equivalent to modeling the prior popularity as the proportion of social agents times the previous popularity of a categorization, plus the proportion of non-social agents times a uniform prior.
These components yield the predicted popularity at each generation to be
\begin{equation}
\frac{\gamma_{it1} \cdot ( p_{it} \cdot (1 - p_{ns}) + 0.5\cdot p_{ns}) }
  {\gamma_{it1} \cdot ( p_{it} \cdot (1 - p_{ns}) + 0.5\cdot p_{ns} ) + \gamma_{it0} \cdot ( (1 - p_{it}) \cdot (1 - p_{ns})+ 0.5\cdot p_{ns} )},
\end{equation}
where $\gamma_{itk} = \theta_{ik}^{S_{it}} (1-\theta_{ik})^{J - S_{it}}$.

\end{document}
