Skip to content

About

Investigating temporal binding through predictive mechanisms: action, causality, and temporal control in time perception. Master's thesis research (PsychoPy experiments + R statistical analysis).

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Temporal Binding & Predictive Processing

Interactive Analysis Reference — MA Thesis

Live Apps

App Description
🔬 Analysis Reference R code, PsychoPy scripts, LMM models
📊 Results Dashboard Interactive charts of experimental findings

## What this is

An interactive reference tool for the analyses, experimental design scripts, and statistical models used across all three experiments of the MA thesis:

**"Sensorimotor Mechanisms of Time Perception: Investigating Temporal Binding Effect Through Predictive Mechanisms"**  
MA Thesis · Cognitive Science · 

---

## App modes

| Mode | Contents |
|---|---|
| 🧪 **Exp 1 Design** | PsychoPy scripts for IC, TC, IP conditions — trial timelines, block switcher, code snippets |
| 🔬 **Exp 2/3 Design** | PsychoPy scripts for Exp 2/3 — catch trials, RT collection, tone scheduling, block variants |
| 📊 **LMM Exp 1** | R analysis code — 4 RATIO analyses, wrangling pipeline, contrast rationale |
| 📈 **LMM Exp 2** | R analysis code — 4 RATIO + 1 RT analysis, na.action notes, RT exclusion |
| 📉 **LMM Exp 3** | R analysis code — 5 RATIO + 1 RT analysis, 80/20 validity, three-way interaction |

---

## Experiment overview

| | Exp 1 | Exp 2 | Exp 3 |
|---|---|---|---|
| **N** | 10 | 41 (42 − 1) | 41 (44 − 3) |
| **Fixed IEI** | 550 ms | 650 ms | 650 ms |
| **Random IEI** | 0–1100 ms | 150–1150 ms | 150–1150 ms |
| **Acq. trials** | 50 | 30 | 30 |
| **Test trials** | 50 | 50 | 50 |
| **Catch trials** | No | Yes (20%) | Yes (20%) |
| **RT collected** | No | Yes | Yes |
| **Test validity** | Uncontrolled | 50/50 | 80/20 |

---

## Conditions

| Code | Name | Action | Validity | Notes |
|---|---|---|---|---|
| **IC** | Identity Control | ✅ Yes | ✅ Yes | Left→Red, Right→Green (100% acq) |
| **TC** | Temporal Control | ✅ Yes | ❌ No | Random colour always |
| **IP** | Identity Prediction | ❌ No | ✅ Yes | Tone-triggered, Low→Red, High→Green |

---

## Block structure

| Block | Code | Condition | Acq. time | Test time |
|---|---|---|---|---|
| 1 | IC-FF | Identity Control | Fixed | Fixed |
| 2 | IC-RF | Identity Control | Random | Fixed |
| 3 | IP-FF | Identity Prediction | Fixed | Fixed |
| 4 | IP-RF | Identity Prediction | Random | Fixed |
| 5 | TC-RR | Temporal Control | Random | Random |
| 6 | TC-FR | Temporal Control | Fixed | Random |
| 7 | TC-RF | Temporal Control | Random | Fixed |
| 8 | TC-FF | Temporal Control | Fixed | Fixed |

---

## Analysis pipeline

All statistical analyses use linear mixed-effects models (LMMs) fit with `lme4`:

1. **Data cleaning** — derive `RATIO`, `log_RATIO`; apply RT exclusion window (100–2000 ms)
2. **Catch trial exclusion** (Exp 2 & 3) — participants with catch accuracy < 80% excluded
3. **Sum contrasts** applied to all categorical predictors via `contr.sum()`
4. **Forward selection** — LRT comparison (ML estimation) to identify fixed effects
5. **Backward selection** — LRT pruning of random effects structure
6. **Confirmatory test** — `afex::mixed()` with `method = "LRT"` on winning model
7. **Outlier trimming** — ±2.5 SD on winning model residuals, model re-run on trimmed data
8. **Assumption checks** — VIF, ACF, residual histogram, Q-Q plot, fitted vs. residual plot

### Analyses per experiment

| Analysis | Subset | DV | Key predictors |
|---|---|---|---|
| MC (IC vs TC) | Blocks 1,2,7,8 | RATIO / log_RATIO (Exp 3) | cond.type × acq.time |
| CP (TC vs IP) | Blocks 5,6,7,8,3,4 | RATIO / log_RATIO (Exp 3) | cond.type × acq.time |
| mvsp (IC vs IP) | Blocks 1,2,3,4 | RATIO | cond.type × acq.time × is_valid |
| t_control (TC only) | Blocks 5,6,7,8 | log_RATIO | acq.time × test.time |
| RT (Exp 2 & 3 only) | IC + IP blocks | log(RT) | cond.type × acq.time × is_valid |

---

## Repository structure

temporal-binding-predictive-processing/ ├── data/ │ ├── exp1_data_n10.csv │ ├── exp2_data_n41.csv │ ├── exp3_data_n41.csv │ ├── conditions_0_1100ms.csv │ ├── conditions_150_1150ms.csv │ └── practice_trials.csv │ ├── scripts/ │ ├── exp1/ │ │ ├── exp1_LMM_RATIO_analysis.R │ │ ├── exp1_identity_control.py │ │ ├── exp1_identity_prediction.py │ │ └── exp1_temporal_control.py │ ├── exp2/ │ │ ├── exp2_RATIO_LMM_analysis.R │ │ ├── exp2_reaction-time_LMM_analysis.R │ │ ├── exp2_identity_control.py │ │ ├── exp2_identity_prediction.py │ │ └── exp2_temporal_control.py │ └── exp3/ │ ├── exp3_RATIO_LMM_analysis.R │ ├── exp3_reaction-time_LMM_analysis.R │ ├── exp3_identity_control.py │ ├── exp3_identity_prediction.py │ └── exp3_temporal_control.py │ ├── src/ ← React app source ├── public/ ├── .github/workflows/ ← GitHub Actions deploy └── figures/ ← generated by R scripts, not tracked


---

## Running locally

```bash
git clone https://github.com/roz-logic/temporal-binding-predictive-processing.git
cd temporal-binding-predictive-processing
npm install
npm run dev

Open http://localhost:5173/temporal-binding-predictive-processing/


Deploying

Deployment is handled automatically via GitHub Actions on every push to main. The workflow builds the Vite app with DEPLOY_TARGET=ghpages and deploys to GitHub Pages.


R dependencies

install.packages(c("here", "tidyverse", "lme4", "afex", "car"))

Tested on R ≥ 4.2. All paths use here::here() — set working directory to repo root.

Python dependencies

  • PsychoPy ≥ 2022.2
  • psychtoolbox (PTB audio backend, required for Identity Prediction scripts)

Stack

  • React 19 + TypeScript
  • Tailwind CSS v4
  • Vite 7
  • GitHub Actions for deployment

Reference

Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv JK. (2019) PsychoPy2: Experiments in behavior made easy. Behav Res 51: 195. https://doi.org/10.3758/s13428-018-01193-y


License

MIT — see LICENSE for details.

About

Investigating temporal binding through predictive mechanisms: action, causality, and temporal control in time perception. Master's thesis research (PsychoPy experiments + R statistical analysis).

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages