A Mathematical Model for Parallel Processing and Integration of Semantic and Spatial Cognition

Author

Your Name

1 Introduction

This document presents a mathematical model that formalizes the integration of semantic and spatial cognition using hierarchical Bayesian inference and the Drift-Diffusion Model (DDM). The model captures how visual stimuli are processed, how semantic and spatial information are encoded and integrated, and how decisions are made based on this information.

2 Theoretical Foundation

2.1 Hierarchical Bayesian Inference

The model uses probabilistic inference to combine sensory inputs with prior knowledge, reflecting the brain’s ability to update beliefs based on new information.

2.2 Drift-Diffusion Model (DDM)

The decision-making process is modeled through evidence accumulation over time until reaching a decision threshold.

3 Model Components

3.1 Sensory Input Layer

The initial visual processing of stimuli is represented as:

\[ S = \{ s_1, s_2, \dots, s_n \} \]

where \(s_i\) is a stimulus (either an object or a scene).

3.2 Semantic Encoding

For object stimuli \(O\), semantic category \(\theta_S\) is inferred using Bayesian inference:

\[ p(\theta_S | O) = \frac{p(O | \theta_S) p(\theta_S)}{\sum_{\theta_S} p(O | \theta_S) p(\theta_S)} \]

Where:

  • \(p(O | \theta_S)\): Likelihood of observing object \(O\) given category \(\theta_S\)
  • \(p(\theta_S)\): Prior probability of category \(\theta_S\)

3.3 Spatial Encoding

For scene stimuli \(C\), spatial context \(\theta_C\) is inferred:

\[ p(\theta_C | C) = \frac{p(C | \theta_C) p(\theta_C)}{\sum_{\theta_C} p(C | \theta_C) p(\theta_C)} \]

3.4 Integration Layer

When semantic and spatial information can be integrated:

\[ p(\theta_S, \theta_C | O, C) = \frac{p(O, C | \theta_S, \theta_C) p(\theta_S, \theta_C)}{\sum_{\theta_S, \theta_C} p(O, C | \theta_S, \theta_C) p(\theta_S, \theta_C)} \]

If \(O\) and \(C\) are independent given \(\theta_S\) and \(\theta_C\):

\[ p(O, C | \theta_S, \theta_C) = p(O | \theta_S) p(C | \theta_C) \]

\[ p(\theta_S, \theta_C) = p(\theta_S) p(\theta_C) \quad \text{(if $\theta_S$ and $\theta_C$ are independent)} \]

4 Decision-Making Layer

4.1 Evidence Accumulation

The Drift-Diffusion Model is represented as:

\[ dx = v dt + \sigma dW_t \]

Where:

  • \(x\): Decision variable
  • \(v\): Drift rate (strength of evidence)
  • \(\sigma\): Noise parameter
  • \(dW_t\): Wiener process increment

4.2 Drift Rates

4.2.1 Semantic Decisions

\[ v_S = k_S \left( p(\theta_S = \theta_{\text{target}} | O) - p(\theta_S = \theta_{\text{distractor}} | O) \right) \]

4.2.2 Spatial Decisions

\[ v_C = k_C \left( p(\theta_C = \theta_{\text{target}} | C) - p(\theta_C = \theta_{\text{distractor}} | C) \right) \]

4.2.3 Integrated Decisions

\[ v_{SC} = k_{SC} \left( p(\theta_S = \theta_{\text{target}}, \theta_C = \theta_{\text{target}} | O, C) - p(\theta_S = \theta_{\text{distractor}}, \theta_C = \theta_{\text{distractor}} | O, C) \right) \]

4.3 Decision Outcomes

4.3.1 Probability of Correct Response

\[ P_{\text{correct}} = \frac{1}{1 + e^{-2 v \alpha / \sigma^2}} \]

4.3.2 Mean Decision Time

\[ E[T] = \frac{\alpha}{v} \tanh\left( \frac{v \alpha}{\sigma^2} \right) \]

5 Implementation in R

Code
library(tidyverse)
library(rstan)
library(bayesplot)

# Function to compute posterior probabilities
compute_posterior <- function(likelihood, prior) {
  numerator <- likelihood * prior
  denominator <- sum(numerator)
  return(numerator / denominator)
}

# Function to simulate drift diffusion process
simulate_ddm <- function(v, sigma, alpha, dt = 0.001, max_t = 10) {
  t <- 0
  x <- 0
  while(abs(x) < alpha && t < max_t) {
    x <- x + v * dt + sigma * sqrt(dt) * rnorm(1)
    t <- t + dt
  }
  return(list(
    decision = sign(x),
    rt = t
  ))
}

6 Example Analysis

Code
# Parameters
v <- 0.85  # drift rate
sigma <- 1  # noise
alpha <- 1  # threshold

# Simulate multiple trials
n_trials <- 1000
results <- replicate(n_trials, simulate_ddm(v, sigma, alpha), simplify = FALSE)

# Extract results
decisions <- sapply(results, function(x) x$decision)
rts <- sapply(results, function(x) x$rt)

# Create dataframe
df <- tibble(
  decision = decisions,
  rt = rts
)

# Plot results
ggplot(df, aes(x = rt)) +
  geom_histogram(bins = 30, fill = "steelblue", alpha = 0.7) +
  facet_wrap(~decision) +
  labs(
    title = "Response Times by Decision",
    x = "Response Time",
    y = "Count"
  ) +
  theme_minimal()

7