# Charls Reproduce

CHARLS (China Health and Retirement Longitudinal Study) database-specific knowledge for...

- Repository: https://github.com/xjtulyc/MedgeClaw (617 stars)
- Category: Data and ML
- License: see repository
- Last updated: 2026-03-12
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add xjtulyc/MedgeClaw --skill charls-reproduce -g -a claude-code -y`
Codex: `npx skills add xjtulyc/MedgeClaw --skill charls-reproduce -g -a codex -y`
Cursor: `npx skills add xjtulyc/MedgeClaw --skill charls-reproduce -g -a cursor -y`
Gemini CLI: `npx skills add xjtulyc/MedgeClaw --skill charls-reproduce -g -a gemini-cli -y`

## Description

CHARLS (China Health and Retirement Longitudinal Study) database-specific knowledge for reproducing published papers. Use when reproducing or analyzing papers that use CHARLS data, including variable mapping from harmonized to raw questionnaire items, cognitive function scoring (episodic memory, mental status, TICS), CESD-10 depression screening, social isolation index construction, and chronic disease coding. Also use for any CHARLS data cleaning, variable construction, or cohort selection task.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# CHARLS Reproduce, CHARLS 数据库复现指南

## CHARLS 概览

| 项目 | 说明 |
|------|------|
| 全称 | China Health and Retirement Longitudinal Study (中国健康与养老追踪调查) |
| 官网 | https://charls.pku.edu.cn/ |
| 覆盖 | 全国 150 县级单位、450 社区，45 岁以上居民 |
| 波次 | wave1(2011), wave2(2013), wave3(2015), wave4(2018), wave5(2020) |
| 格式 | Stata (.dta), 也有 harmonized 版本 |

## Harmonized 数据集 vs 原始数据

大多数 CHARLS 论文使用**原始问卷模块数据**，变量名以 CHARLS 问卷编号命名（如 `dc009s1`）。但很多用户拿到的是 **harmonized 数据集**（合并所有波次，变量已清洗重命名）。

**识别方法**:
- 如果有 `wave` 列且包含 `wave1`-`wave5` → harmonized 数据
- 如果有 `dc009s1`, `be001`, `sc004_s1` 等原始变量名 → 原始数据
- harmonized 数据通常 ~10 万行（所有波次堆叠），原始数据每波 ~2 万行

**关键差异**: 变量名完全不同，缺失模式不同，编码方式不同。

## 核心变量映射表

### 认知功能

| 论文常用名 | 原始变量 | Harmonized 变量 | 范围 | 说明 |
|-----------|---------|----------------|------|------|
| 即时回忆 | `dc009s1`, `dc009s10` | `imrc` | 0-10 | 10 个词即时回忆正确数 |
| 延迟回忆 | `dc012s1`, `dc012s10` | `dlrc` | 0-10 | 延迟回忆正确数 |
| 情景记忆 (EM) | 自行计算 | `recall` 或 `(imrc+dlrc)/2` | 0-10 | **注意**: `recall` = `(imrc+dlrc)/2` |
| Serial 7 | `dc024` (5 次减法) | `ser7` | 0-5 | 100 连续减 7，正确次数 |
| 日期定向 | `dc003`-`dc006` | `orient` | 0-4 | = dw + dy + mo + yr（4 个二分项之和） |
| 画图 | `dc014` | `draw` | 0-1 | 重画展示图形是否正确 |
| 心理状态 (MS) | 自行计算 | `ser7 + orient + draw` | 0-10 | **重要**: 见下方详解 |
| 总认知分 | 自行计算 | `total_cognition` | 0-21 | 但 ≠ imrc+dlrc+ser7+orient+draw |

#### 心理状态 (Mental Status) 构建详解

论文中 MS 通常定义为 TICS 题目总分 = Serial 7 + 日期定向 + 画图 = 0-10。

但**注意**：
- `orient` = `dw + dy + mo + yr`（4 项，0-4），**不含** `ds`（day of season）
- 验证方法: `orient == dw + dy + mo + yr` 应 100% 吻合
- **如果论文 MS 均值 ~5-7**: 使用 `ser7 + orient + draw`（0-10）
- **如果论文 MS 均值 ~3-4**: 可能只用了 `orient + draw`（0-5），不含 ser7
- **`ser7` 缺失率高**（Wave1 约 19%），如果样本量偏差大，考虑排除 ser7

> **关键经验**: `ser7` 是 MS 定义中缺失率最高的子项。
> 如果筛选后样本量比论文少很多，先检查是否因 `ser7` 缺失。
> 尝试 `ms = orient + draw` 看样本量是否更接近论文。

### 抑郁 (CESD-10)

The rest: https://github.com/xjtulyc/MedgeClaw/blob/HEAD/skills/charls-reproduce/SKILL.md
