# Replication Package for Prompt Adaptation as a Dynamic Complement in Generative AI Systems

Paper: [arxiv.org/abs/2407.14333](https://arxiv.org/abs/2407.14333)

## Quick Start

### Prerequisites

- **R 4.5+**
- **rv** — R package manager ([install instructions](https://github.com/A2-ai/rv#installation))

### Setup (one-time)

```bash
./setup.sh
```

### Run All Analyses

```bash
./execute_analyses.sh
```

This runs all 16 analysis scripts (12 similarity experiment + 4 logo experiment),
times each one, and saves logs to `logs/`. Stops on first failure.

Scripts explicitly output tables and figures to `outputs/`. Inline statistics
(e.g., hypothesis test results) can be reviewed in the console logs under
`logs/` and via commented code within the analysis scripts.

## Data

- [Data Dictionary](DATA_DICTIONARY.md) — column-level documentation for all input datasets

## Experiment Details

- [Similarity Experiment README](similarity_exp_replication/SIMILARITY_EXP_README.md) — 12 scripts covering paper figures, tables, and pre-registered hypotheses H1–H8
- [Logo Experiment README](logo_exp_replication/LOGO_EXP_README.md) — 4 scripts covering logo task figures, tables, and additional analyses

## Structure

```
├── setup.sh                    # One-time environment setup
├── execute_analyses.sh         # Run all analyses with timing
├── rproject.toml               # Package dependencies (rv config)
├── rv.lock                     # Locked package versions
├── shared/                     # Shared utilities across experiments
│   ├── utils.R
│   └── hash_userId.R
├── similarity_exp_replication/       # Similarity experiment (see SIMILARITY_EXP_README.md)
│   ├── code/analysis/
│   ├── inputs/
│   └── outputs/
└── logo_exp_replication/       # Logo experiment (see LOGO_EXP_README.md)
    ├── code/analysis/
    ├── inputs/
    └── outputs/
```

## Environment

- **Package management**: [rv](https://github.com/A2-ai/rv) — dependencies are
  declared in `rproject.toml` and pinned in `rv.lock`. To add a package, edit
  `rproject.toml` and run `rv sync`.
- **Path management**: [here](https://here.r-lib.org/) — all scripts use
  `here()` for relative paths, anchored to the project root (where `.Rproj`
  lives). No hardcoded paths.
