[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DAQFMY78AWZ21KRN80CCAK":3,"skill-same:01M6DAQFMY78AWZ21KRN80CCAK":64},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":14,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":49,"install":50,"resources":63},"01M6DAQFMY78AWZ21KRN80CCAK","tooluniverse-epidemiological-analysis",null,"End-to-end epidemiological data analysis — from research question to statistical report. Covers study design assessment, dataset discovery and download, data wrangling, confounder adjustment, regression modeling, sensitivity analysis, visualization, and biological interpretation. Integrates ToolUniverse tools for dataset discovery, literature search, and biological context with Python code execution for data analysis. Use whenever users ask to analyze health data, study disease risk factors, assess exposure-outcome relationships, or conduct observational epidemiology. Also use when users want to run regression on clinical\u002Fsurvey data, calculate odds ratios or hazard ratios from a dataset, adjust for confounders, or produce a Table 1. If the task involves downloading a health dataset and running statistical analysis on it, this is the right skill.","Prekzursil\u002Fagent-skills-toolchain","Prekzursil","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F54636077?v=4","01M6DACZ1PCQHD99SCR1YXG28B","Andrei Mihai Visalon","01M6DACZ670WZF535V3WYYSS4Z",0,"MIT","https:\u002F\u002Fgithub.com\u002FPrekzursil\u002Fagent-skills-toolchain\u002Fblob\u002Fmain\u002F.agents\u002Flibrary\u002Fskills\u002Ftooluniverse-epidemiological-analysis\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"tooluniverse epidemiological analysis","analysis","discovery","clinical","end","adjust","sensitivity","study","survey","question","regression","design","risk","execution","search","visualization","assessment","interpretation","sensitivity analysis","python","2026-11-10 10:12:30",false,"---\nname: tooluniverse-epidemiological-analysis\ndescription: End-to-end epidemiological data analysis — from research question to statistical report. Covers study design assessment, dataset discovery and download, data wrangling, confounder adjustment, regression modeling, sensitivity analysis, visualization, and biological interpretation. Integrates ToolUniverse tools for dataset discovery, literature search, and biological context with Python code execution for data analysis. Use whenever users ask to analyze health data, study disease risk factors, assess exposure-outcome relationships, or conduct observational epidemiology. Also use when users want to run regression on clinical\u002Fsurvey data, calculate odds ratios or hazard ratios from a dataset, adjust for confounders, or produce a Table 1. If the task involves downloading a health dataset and running statistical analysis on it, this is the right skill.\n---\n\n# Epidemiological Data Analysis\n\nComplete workflow for observational epidemiology — from research question to publication-ready report. Write and run Python code for every step. Never describe what you \"would do\" — do it.\n\n## Step 1: Formulate the Research Question (PECO Framework)\n\nDefine **P**opulation, **E**xposure, **C**omparator, **O**utcome before touching data.\n\n- **Population**: Who? (e.g., adults aged 20-79, cancer patients stage III+, ICU admissions)\n- **Exposure**: What factor? (e.g., nutrient intake, drug treatment, gene mutation, environmental pollutant)\n- **Comparator**: Vs. what? (e.g., lowest tertile, unexposed, wild-type, placebo)\n- **Outcome**: What health event? (e.g., disease incidence, survival time, biomarker level, mortality)\n\n**Study design check**: Does the question require temporality?\n- Cross-sectional: prevalence, associations at one time point\n- Longitudinal\u002Fcohort: incidence, causal inference, temporal relationships\n- Case-control: rare outcomes, odds ratios (nested within cohort)\n- Clinical trial: intervention effects with randomized controls\n\nIf the question implies causation (\"does X cause Y?\") but only cross-sectional data is available, state the limitation explicitly and proceed with association language.\n\n## Step 2: Find and Evaluate Data\n\nUse ToolUniverse to discover datasets and find what prior studies used:\n\n```python\n# Search for relevant datasets — use find_tools to discover what's available\nfind_tools(\"dataset search\")\nfind_tools(\"your domain keywords\")  # e.g., \"cancer genomics\", \"clinical trial\", \"survey health\"\n\n# Search literature for study precedents — papers cite their data sources\nexecute_tool(\"PubMed_search_articles\", {\"query\": \"[exposure] [outcome] [study design]\", \"max_results\": 5})\nexecute_tool(\"EuropePMC_search_articles\", {\"query\": \"[exposure] [outcome] cohort\", \"limit\": 5})\n```\n\n**Evaluate dataset fitness**: Does it have the exposure variable? The outcome? Key confounders (age, sex, plus domain-specific)? Adequate sample size?\n\n**Power analysis** (run before committing to a dataset):\n\n```python\nfrom scipy.stats import norm\nimport numpy as np\n\ndef sample_size_logistic(p0, OR, alpha=0.05, power=0.80):\n    \"\"\"Minimum N for logistic regression detecting OR at given power.\"\"\"\n    p1 = (p0 * OR) \u002F (1 - p0 + p0 * OR)\n    z_a, z_b = norm.ppf(1 - alpha\u002F2), norm.ppf(power)\n    n = ((z_a + z_b)**2 * (1\u002F(p0*(1-p0)) + 1\u002F(p1*(1-p1)))) \u002F (np.log(OR))**2\n    return int(np.ceil(n))\n\nprint(f\"Need N={sample_size_logistic(0.10, 1.5)} for OR=1.5 with 10% baseline prevalence\")\n```\n\n## Step 3: Download and Prepare Data\n\nDownload data programmatically. Adapt the loading code to your data source's format.\n\n```python\nimport pandas as pd\nimport requests, io\n\n# Generic download helper — adapt URL and format to your source\ndef download_and_parse(url, fmt=\"csv\"):\n    r = requests.get(url, timeout=120)\n    content = io.BytesIO(r.content)\n    if fmt == \"xpt\":\n        return pd.read_sas(content, format=\"xport\")\n    elif fmt == \"csv\":\n        return pd.read_csv(content)\n    elif fmt == \"tsv\":\n        return pd.read_csv(content, sep=\"\\t\")\n    elif fmt == \"stata\":\n        return pd.read_stata(content)\n    elif fmt == \"json\":\n        return pd.read_json(content)\n    else:\n        return pd.read_csv(content)  # default fallback\n\n# Load and merge multiple files on shared ID column\ndf1 = download_and_parse(url1, fmt=\"xpt\")\ndf2 = download_and_parse(url2, fmt=\"xpt\")\ndf = df1.merge(df2, on=\"id_col\", how=\"inner\")\n\n# Filter population (inclusion\u002Fexclusion criteria)\ndf = df[(df['age'] >= 20) & (df['age'] \u003C 80)]\n\n# Handle missing data\nmissing_pct = df.isnull().mean() * 100\nprint(\"Missing % per variable:\\n\", missing_pct[missing_pct > 0].sort_values(ascending=False))\n# Decision: complete case if \u003C5% missing; multiple imputation if 5-20%; drop variable if >20%\n\n# Variable coding (adapt to your data)\ndf['age_group'] = pd.cut(df['age'], bins=[20,40,60,80], labels=['20-39','40-59','60-79'])\ndf['outcome_binary'] = (df['outcome_continuous'] >= threshold).astype(int)\n```\n\n**Survey weights**: Some surveys (NHANES, BRFSS, MEPS) require sampling weights for valid inference. Check the survey documentation. For weighted regression, use `statsmodels.stats.weightstats` or linearmodels.\n\n**REST API data**: For sources like GDC (TCGA), ClinicalTrials.gov, or OpenTargets, paginate through the API:\n```python\nall_records = []\noffset = 0\nwhile True:\n    resp = requests.get(f\"{api_url}?offset={offset}&limit=500\", timeout=30)\n    batch = resp.json().get(\"data\", [])\n    if not batch:\n        break\n    all_records.extend(batch)\n    offset += len(batch)\ndf = pd.DataFrame(all_records)\n```\n\n## Step 4: Descriptive Statistics (Table 1)\n\n```python\n# Table 1: mean +\u002F- SD for continuous, N(%) for categorical, by exposure group\ncontinuous_vars = ['age', 'bmi']  # adapt to your variables\nfor var in continuous_vars:\n    print(df.groupby('exposure_group')[var].agg(['mean', 'std', 'count']))\n\ncategorical_vars = ['sex', 'race']  # adapt to your variables\nfor var in categorical_vars:\n    print(pd.crosstab(df['exposure_group'], df[var], normalize='index') * 100)\n```\n\nCheck distributions: `df[var].skew()`, `scipy.stats.shapiro()`, histograms for outliers.\n\n## Step 5: Regression Analysis\n\n**Sequential adjustment strategy** (build evidence for confounding):\n\n```python\nimport statsmodels.formula.api as smf\nimport numpy as np\n\n# Model 1: Unadjusted\nm1 = smf.logit('outcome ~ exposure', data=df).fit(disp=0)\n\n# Model 2: + demographics\nm2 = smf.logit('outcome ~ exposure + age + sex + race', data=df).fit(disp=0)\n\n# Model 3: + clinical factors\nm3 = smf.logit('outcome ~ exposure + age + sex + race + bmi + smoking + alcohol', data=df).fit(disp=0)\n\n# Report ORs with 95% CI\nfor name, model in [('Unadjusted', m1), ('Demographics', m2), ('Fully adjusted', m3)]:\n    or_val = np.exp(model.params['exposure'])\n    ci = np.exp(model.conf_int().loc['exposure'])\n    print(f\"{name}: OR={or_val:.2f} (95% CI: {ci[0]:.2f}-{ci[1]:.2f}), p={model.pvalues['exposure']:.4f}\")\n```\n\n**Model selection by outcome type**:\n- Continuous outcome: `smf.ols()`\n- Binary outcome: `smf.logit()`\n- Ordered categories: `OrderedModel` from statsmodels\n- Time-to-event: `CoxPHFitter` from lifelines\n- Count data: `smf.poisson()` or `smf.negativebinomial()`\n\n**Assumption checks**:\n\n```python\nfrom statsmodels.stats.outliers_influence import variance_inflation_factor\n\n# Multicollinearity (VIF > 5 is concerning, > 10 is severe)\nX = df[['age', 'bmi', 'exposure']].dropna()\nfor i, col in enumerate(X.columns):\n    print(f\"VIF {col}: {variance_inflation_factor(X.values, i):.1f}\")\n```\n\n## Step 6: Sensitivity Analyses\n\n```python\n# Stratified analysis (effect modification)\nfor stratum_var in ['sex', 'age_group', 'race']:\n    print(f\"\\n--- Stratified by {stratum_var} ---\")\n    for level, sub in df.groupby(stratum_var):\n        if len(sub) \u003C 50: continue\n        try:\n            m = smf.logit('outcome ~ exposure + age + bmi', data=sub).fit(disp=0)\n            or_val = np.exp(m.params['exposure'])\n            ci = np.exp(m.conf_int().loc['exposure'])\n            print(f\"  {level}: OR={or_val:.2f} ({ci[0]:.2f}-{ci[1]:.2f}), p={m.pvalues['exposure']:.3f}, N={len(sub)}\")\n        except: print(f\"  {level}: model failed (N={len(sub)})\")\n\n# Exclude outliers (+\u002F- 3 SD) and re-run\ndf_no_outliers = df[np.abs(stats.zscore(df['exposure'].dropna())) \u003C 3]\nm_robust = smf.logit('outcome ~ exposure + age + sex + bmi', data=df_no_outliers).fit(disp=0)\n\n# Confounder-adjusted exposure (residual method, e.g., energy-adjusted nutrient intake)\n# Use when exposure correlates strongly with a confounder (total calories, body size, etc.)\nadj_model = smf.ols('exposure ~ confounder', data=df).fit()\ndf['exposure_adj'] = adj_model.resid\n\n# Multiple comparisons note\nn_tests = 5  # number of exposure-outcome pairs tested\nbonferroni_threshold = 0.05 \u002F n_tests\n```\n\n## Step 7: Biological Interpretation (ToolUniverse Advantage)\n\nThis is where ToolUniverse adds value beyond any statistics package. After finding a statistical association, investigate the biological plausibility. Use `find_tools` to discover the right tools for your domain.\n\n```python\n# 1. Literature evidence — search for mechanism connecting exposure to outcome\nexecute_tool(\"PubMed_search_articles\", {\"query\": \"[exposure] [outcome] mechanism\", \"max_results\": 5})\nexecute_tool(\"EuropePMC_search_articles\", {\"query\": \"[exposure] [outcome] mouse model in vivo\", \"limit\": 5})\n\n# 2. Pathway\u002Fmolecular context — discover tools for your exposure type\nfind_tools(\"[exposure type] pathway\")       # e.g., \"nutrient pathway\", \"drug target\", \"chemical toxicology\"\nfind_tools(\"[outcome type] gene disease\")   # e.g., \"diabetes gene\", \"cancer survival\", \"cardiac risk\"\n\n# 3. Gene-disease evidence (if a gene\u002Fvariant is involved)\nfind_tools(\"gene disease association\")\nfind_tools(\"variant functional annotation\")\n\n# 4. Drug\u002Fchemical mechanisms (if a drug or chemical is the exposure)\nfind_tools(\"drug mechanism target\")\nfind_tools(\"chemical gene interaction\")\n```\n\n**The pattern**: Exposure X → (what molecular pathway?) → (what biological process?) → Outcome Y. Use ToolUniverse tools to fill in the middle steps. This converts a statistical association into a biologically plausible hypothesis.\n\n## Step 8: Visualization\n\nKey plots to produce (use matplotlib):\n- **Forest plot**: stratified ORs with 95% CI, vertical reference line at OR=1, log scale x-axis\n- **Dose-response curve**: exposure quartile medians on x-axis vs outcome prevalence\u002Fmean on y-axis\n- **DAG**: directed acyclic graph showing assumed causal structure (exposure, confounders, outcome)\n- **Scatter + regression line**: for continuous outcomes with `sns.regplot()`\n\n## Step 9: Report Structure\n\nWrite the final report in this order:\n\n1. **Background**: What is known, what gap this analysis addresses (cite PubMed searches from Step 7)\n2. **Methods**: PECO, data source, inclusion\u002Fexclusion, variable definitions, statistical approach, sensitivity analyses\n3. **Results**: Table 1, unadjusted and adjusted ORs\u002FHRs, stratified results, dose-response, sensitivity checks\n4. **Discussion**: Compare to prior literature (PubMed), biological plausibility (ToolUniverse pathway\u002Fmechanism findings), clinical significance of effect size\n5. **Limitations**: Study design constraints, unmeasured confounding, selection bias, measurement error, generalizability\n\n**Key limitations to always state**:\n- Cross-sectional design cannot establish temporality (if applicable)\n- Residual confounding from unmeasured variables\n- Self-reported exposure data may have recall bias\n- Survey weights may not fully account for non-response bias\n\n## Completeness Checklist\n\nBefore finalizing any epidemiological analysis:\n\n- [ ] PECO defined and documented\n- [ ] Study design matches the research question\n- [ ] Sample size adequate (power analysis done)\n- [ ] Missing data reported and handled\n- [ ] Table 1 produced\n- [ ] Unadjusted AND adjusted models reported\n- [ ] Confounders justified (not just statistically selected)\n- [ ] Assumptions checked (VIF, linearity, model fit)\n- [ ] At least one sensitivity analysis performed\n- [ ] Biological plausibility investigated via ToolUniverse\n- [ ] Effect size interpreted in clinical context (not just p-value)\n- [ ] Limitations explicitly stated\n","# Epidemiological Data Analysis\n\nComplete workflow for observational epidemiology — from research question to publication-ready report. Write and run Python code for every step. Never describe what you \"would do\" — do it.\n\n## Step 1: Formulate the Research Question (PECO Framework)\n\nDefine **P**opulation, **E**xposure, **C**omparator, **O**utcome before touching data.\n\n- **Population**: Who? (e.g., adults aged 20-79, cancer patients stage III+, ICU admissions)\n- **Exposure**: What factor? (e.g., nutrient intake, drug treatment, gene mutation, environmental pollutant)\n- **Comparator**: Vs. what? (e.g., lowest tertile, unexposed, wild-type, placebo)\n- **Outcome**: What health event? (e.g., disease incidence, survival time, biomarker level, mortality)\n\n**Study design check**: Does the question require temporality?\n- Cross-sectional: prevalence, associations at one time point\n- Longitudinal\u002Fcohort: incidence, causal inference, temporal relationships\n- Case-control: rare outcomes, odds ratios (nested within cohort)\n- Clinical trial: intervention effects with randomized controls\n\nIf the question implies causation (\"does X cause Y?\") but only cross-sectional data is available, state the limitation explicitly and proceed with association language.\n\n## Step 2: Find and Evaluate Data\n\nUse ToolUniverse to discover datasets and find what prior studies used:\n\n```python\n# Search for relevant datasets — use find_tools to discover what's available\nfind_tools(\"dataset search\")\nfind_tools(\"your domain keywords\")  # e.g., \"cancer genomics\", \"clinical trial\", \"survey health\"\n\n# Search literature for study precedents — papers cite their data sources\nexecute_tool(\"PubMed_search_articles\", {\"query\": \"[exposure] [outcome] [study design]\", \"max_results\": 5})\nexecute_tool(\"EuropePMC_search_articles\", {\"query\": \"[exposure] [outcome] cohort\", \"limit\": 5})\n```\n\n**Evaluate dataset fitness**: Does it have the exposure variable? The outcome? Key confounders (age, sex, plus domain-specific)? Adequate sample size?\n\n**Power analysis** (run before committing to a dataset):\n\n```python\nfrom scipy.stats import norm\nimport numpy as np\n\ndef sample_size_logistic(p0, OR, alpha=0.05, power=0.80):\n    \"\"\"Minimum N for logistic regression detecting OR at given power.\"\"\"\n    p1 = (p0 * OR) \u002F (1 - p0 + p0 * OR)\n    z_a, z_b = norm.ppf(1 - alpha\u002F2), norm.ppf(power)\n    n = ((z_a + z_b)**2 * (1\u002F(p0*(1-p0)) + 1\u002F(p1*(1-p1)))) \u002F (np.log(OR))**2\n    return int(np.ceil(n))\n\nprint(f\"Need N={sample_size_logistic(0.10, 1.5)} for OR=1.5 with 10% baseline prevalence\")\n```\n\n## Step 3: Download and Prepare Data\n\nDownload data programmatically. Adapt the loading code to your data source's format.\n\n```python\nimport pandas as pd\nimport requests, io\n\n# Generic download helper — adapt URL and format to your source\ndef download_and_parse(url, fmt=\"csv\"):\n    r = requests.get(url, timeout=120)\n    content = io.BytesIO(r.content)\n    if fmt == \"xpt\":\n        return pd.read_sas(content, format=\"xport\")\n    elif fmt == \"csv\":\n        return pd.read_csv(content)\n    elif fmt == \"tsv\":\n        return pd.read_csv(content, sep=\"\\t\")\n    elif fmt == \"stata\":\n        return pd.read_stata(content)\n    elif fmt == \"json\":\n        return pd.read_json(content)\n    else:\n        return pd.read_csv(content)  # default fallback\n\n# Load and merge multiple files on shared ID column\ndf1 = download_and_parse(url1, fmt=\"xpt\")\ndf2 = download_and_parse(url2, fmt=\"xpt\")\ndf = df1.merge(df2, on=\"id_col\", how=\"inner\")\n\n# Filter population (inclusion\u002Fexclusion criteria)\ndf = df[(df['age'] >= 20) & (df['age'] \u003C 80)]\n\n# Handle missing data\nmissing_pct = df.isnull().mean() * 100\nprint(\"Missing % per variable:\\n\", missing_pct[missing_pct > 0].sort_values(ascending=False))\n# Decision: complete case if \u003C5% missing; multiple imputation if 5-20%; drop variable if >20%\n\n# Variable coding (adapt to your data)\ndf['age_group'] = pd.cut(df['age'], bins=[20,40,60,80], labels=['20-39','40-59','60-79'])\ndf['outcome_binary'] = (df['outcome_continuous'] >= threshold).astype(int)\n```\n\n**Survey weights**: Some surveys (NHANES, BRFSS, MEPS) require sampling weights for valid inference. Check the survey documentation. For weighted regression, use `statsmodels.stats.weightstats` or linearmodels.\n\n**REST API data**: For sources like GDC (TCGA), ClinicalTrials.gov, or OpenTargets, paginate through the API:\n```python\nall_records = []\noffset = 0\nwhile True:\n    resp = requests.get(f\"{api_url}?offset={offset}&limit=500\", timeout=30)\n    batch = resp.json().get(\"data\", [])\n    if not batch:\n        break\n    all_records.extend(batch)\n    offset += len(batch)\ndf = pd.DataFrame(all_records)\n```\n\n## Step 4: Descriptive Statistics (Table 1)\n\n```python\n# Table 1: mean +\u002F- SD for continuous, N(%) for categorical, by exposure group\ncontinuous_vars = ['age', 'bmi']  # adapt to your variables\nfor var in continuous_vars:\n    print(df.groupby('exposure_group')[var].agg(['mean', 'std', 'count']))\n\ncategorical_vars = ['sex', 'race']  # adapt to your variables\nfor var in categorical_vars:\n    print(pd.crosstab(df['exposure_group'], df[var], normalize='index') * 100)\n```\n\nCheck distributions: `df[var].skew()`, `scipy.stats.shapiro()`, histograms for outliers.\n\n## Step 5: Regression Analysis\n\n**Sequential adjustment strategy** (build evidence for confounding):\n\n```python\nimport statsmodels.formula.api as smf\nimport numpy as np\n\n# Model 1: Unadjusted\nm1 = smf.logit('outcome ~ exposure', data=df).fit(disp=0)\n\n# Model 2: + demographics\nm2 = smf.logit('outcome ~ exposure + age + sex + race', data=df).fit(disp=0)\n\n# Model 3: + clinical factors\nm3 = smf.logit('outcome ~ exposure + age + sex + race + bmi + smoking + alcohol', data=df).fit(disp=0)\n\n# Report ORs with 95% CI\nfor name, model in [('Unadjusted', m1), ('Demographics', m2), ('Fully adjusted', m3)]:\n    or_val = np.exp(model.params['exposure'])\n    ci = np.exp(model.conf_int().loc['exposure'])\n    print(f\"{name}: OR={or_val:.2f} (95% CI: {ci[0]:.2f}-{ci[1]:.2f}), p={model.pvalues['exposure']:.4f}\")\n```\n\n**Model selection by outcome type**:\n- Continuous outcome: `smf.ols()`\n- Binary outcome: `smf.logit()`\n- Ordered categories: `OrderedModel` from statsmodels\n- Time-to-event: `CoxPHFitter` from lifelines\n- Count data: `smf.poisson()` or `smf.negativebinomial()`\n\n**Assumption checks**:\n\n```python\nfrom statsmodels.stats.outliers_influence import variance_inflation_factor\n\n# Multicollinearity (VIF > 5 is concerning, > 10 is severe)\nX = df[['age', 'bmi', 'exposure']].dropna()\nfor i, col in enumerate(X.columns):\n    print(f\"VIF {col}: {variance_inflation_factor(X.values, i):.1f}\")\n```\n\n## Step 6: Sensitivity Analyses\n\n```python\n# Stratified analysis (effect modification)\nfor stratum_var in ['sex', 'age_group', 'race']:\n    print(f\"\\n--- Stratified by {stratum_var} ---\")\n    for level, sub in df.groupby(stratum_var):\n        if len(sub) \u003C 50: continue\n        try:\n            m = smf.logit('outcome ~ exposure + age + bmi', data=sub).fit(disp=0)\n            or_val = np.exp(m.params['exposure'])\n            ci = np.exp(m.conf_int().loc['exposure'])\n            print(f\"  {level}: OR={or_val:.2f} ({ci[0]:.2f}-{ci[1]:.2f}), p={m.pvalues['exposure']:.3f}, N={len(sub)}\")\n        except: print(f\"  {level}: model failed (N={len(sub)})\")\n\n# Exclude outliers (+\u002F- 3 SD) and re-run\ndf_no_outliers = df[np.abs(stats.zscore(df['exposure'].dropna())) \u003C 3]\nm_robust = smf.logit('outcome ~ exposure + age + sex + bmi', data=df_no_outliers).fit(disp=0)\n\n# Confounder-adjusted exposure (residual method, e.g., energy-adjusted nutrient intake)\n# Use when exposure correlates strongly with a confounder (total calories, body size, etc.)\nadj_model = smf.ols('exposure ~ confounder', data=df).fit()\ndf['exposure_adj'] = adj_model.resid\n\n# Multiple comparisons note\nn_tests = 5  # number of exposure-outcome pairs tested\nbonferroni_threshold = 0.05 \u002F n_tests\n```\n\n## Step 7: Biological Interpretation (ToolUniverse Advantage)\n\nThis is where ToolUniverse adds value beyond any statistics package. After finding a statistical association, investigate the biological plausibility. Use `find_tools` to discover the right tools for your domain.\n\n```python\n# 1. Literature evidence — search for mechanism connecting exposure to outcome\nexecute_tool(\"PubMed_search_articles\", {\"query\": \"[exposure] [outcome] mechanism\", \"max_results\": 5})\nexecute_tool(\"EuropePMC_search_articles\", {\"query\": \"[exposure] [outcome] mouse model in vivo\", \"limit\": 5})\n\n# 2. Pathway\u002Fmolecular context — discover tools for your exposure type\nfind_tools(\"[exposure type] pathway\")       # e.g., \"nutrient pathway\", \"drug target\", \"chemical toxicology\"\nfind_tools(\"[outcome type] gene disease\")   # e.g., \"diabetes gene\", \"cancer survival\", \"cardiac risk\"\n\n# 3. Gene-disease evidence (if a gene\u002Fvariant is involved)\nfind_tools(\"gene disease association\")\nfind_tools(\"variant functional annotation\")\n\n# 4. Drug\u002Fchemical mechanisms (if a drug or chemical is the exposure)\nfind_tools(\"drug mechanism target\")\nfind_tools(\"chemical gene interaction\")\n```\n\n**The pattern**: Exposure X → (what molecular pathway?) → (what biological process?) → Outcome Y. Use ToolUniverse tools to fill in the middle steps. This converts a statistical association into a biologically plausible hypothesis.\n\n## Step 8: Visualization\n\nKey plots to produce (use matplotlib):\n- **Forest plot**: stratified ORs with 95% CI, vertical reference line at OR=1, log scale x-axis\n- **Dose-response curve**: exposure quartile medians on x-axis vs outcome prevalence\u002Fmean on y-axis\n- **DAG**: directed acyclic graph showing assumed causal structure (exposure, confounders, outcome)\n- **Scatter + regression line**: for continuous outcomes with `sns.regplot()`\n\n## Step 9: Report Structure\n\nWrite the final report in this order:\n\n1. **Background**: What is known, what gap this analysis addresses (cite PubMed searches from Step 7)\n2. **Methods**: PECO, data source, inclusion\u002Fexclusion, variable definitions, statistical approach, sensitivity analyses\n3. **Results**: Table 1, unadjusted and adjusted ORs\u002FHRs, stratified results, dose-response, sensitivity checks\n4. **Discussion**: Compare to prior literature (PubMed), biological plausibility (ToolUniverse pathway\u002Fmechanism findings), clinical significance of effect size\n5. **Limitations**: Study design constraints, unmeasured confounding, selection bias, measurement error, generalizability\n\n**Key limitations to always state**:\n- Cross-sectional design cannot establish temporality (if applicable)\n- Residual confounding from unmeasured variables\n- Self-reported exposure data may have recall bias\n- Survey weights may not fully account for non-response bias\n\n## Completeness Checklist\n\nBefore finalizing any epidemiological analysis:\n\n- [ ] PECO defined and documented\n- [ ] Study design matches the research question\n- [ ] Sample size adequate (power analysis done)\n- [ ] Missing data reported and handled\n- [ ] Table 1 produced\n- [ ] Unadjusted AND adjusted models reported\n- [ ] Confounders justified (not just statistically selected)\n- [ ] Assumptions checked (VIF, linearity, model fit)\n- [ ] At least one sensitivity analysis performed\n- [ ] Biological plausibility investigated via ToolUniverse\n- [ ] Effect size interpreted in clinical context (not just p-value)\n- [ ] Limitations explicitly stated\n",{"name":5,"description":7},"main","a298c929b6cbd662e1fce54302ce520d5ceea1a5",".agents\u002Flibrary\u002Fskills\u002Ftooluniverse-epidemiological-analysis","https:\u002F\u002Fgithub.com\u002FPrekzursil\u002Fagent-skills-toolchain","https:\u002F\u002Fgithub.com\u002FPrekzursil","2026-11-02 14:30:57",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add Prekzursil\u002Fagent-skills-toolchain --skill tooluniverse-epidemiological-analysis",{"tool":56,"command":57},"bunx","bunx skills add Prekzursil\u002Fagent-skills-toolchain --skill tooluniverse-epidemiological-analysis",{"tool":59,"command":60},"pnpm","pnpm dlx skills add Prekzursil\u002Fagent-skills-toolchain --skill tooluniverse-epidemiological-analysis","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FPrekzursil\u002Fagent-skills-toolchain\u002Fblob\u002Fmain\u002F.agents\u002Flibrary\u002Fskills\u002Ftooluniverse-epidemiological-analysis\u002FSKILL.md",true,[],[65,85,111,132,146,161],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":39},"01M6DF7D7478R55P46REYH4QAC","clarify-requirements","Resolve genuine pre-execution ambiguity by scanning repo context, generating 1-6 grounded options, and asking 1-3 focused questions via AskUserQuestion. NOT for mid-task use (injection risk); NOT when the goal is already unambiguous; use to disambiguate vague prompts before any file edits.","https:\u002F\u002Fgithub.com\u002FPrekzursil\u002Fagent-skills-toolchain\u002Fblob\u002Fmain\u002Ftools\u002Fworkspace-hooks\u002Fskills\u002Fclarify-requirements\u002FSKILL.md",[],[72,73,74,31,75,76,77,78,79,80,81,82,83,32,84],"clarify requirements","clarify","requirements","options","task","prompts","goal","scanning","use","context","repo","injection","file",{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":39},"01M6DF79CA4BHJS66J8EZDBPWJ","openmm-md","Run FREE, open-source, Windows-native GPU molecular dynamics via the openmm-md MCP (OpenMM + CUDA on the local NVIDIA GPU). Use for protein \u002F protein-ligand MD when you want a free stack or are on Windows without a Schrodinger license. Covers the full workflow (prepare, solvate, minimize, equilibrate, production, analyze, mmgbsa) AND an honest decision guide vs Schrodinger Desmond, including how to run Desmond legitimately on Linux or a cloud GPU with a real license. This is a deliberately LESSER free alternative and does NOT replace the schrodinger MCP tools. Do NOT use it to pick a free tool when a validated FEP+, WaterMap, IFD-MD, or Prime MM-GBSA result is actually required.","https:\u002F\u002Fgithub.com\u002FPrekzursil\u002Fagent-skills-toolchain\u002Fblob\u002Fmain\u002Ftools\u002Fmcp\u002Fopenmm-md-mcp\u002Fskill\u002Fopenmm-md\u002FSKILL.md",[],[92,93,94,95,96,97,98,99,100,101,102,103,104,105,80,106,107,108,109,110],"openmm md","how","decision","pick","linux","analyze","tool","stack","open","NVIDIA","gpu","license","workflow","windows","free","molecular dynamics","local","do","MCP",{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":39},"01M6DF76C1MG85VEWP8VZCBNMN","visual-review","Take screenshots of web pages and UI using Playwright for visual review and iteration","https:\u002F\u002Fgithub.com\u002FPrekzursil\u002Fagent-skills-toolchain\u002Fblob\u002Fmain\u002Ftools\u002Feditor\u002Fmetaswarm\u002Fskills\u002Fvisual-review\u002FSKILL.md",[],[118,119,120,121,122,123,124,125,126,127,93,128,129,130,131],"review","visual","visual review","pages","web","false","iteration","take","check","slides","ui","screenshot","playwright","screenshots",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":138,"publishedAt":39},"01M6DF73AQVCBZKEN0YXEX9FXP","status","Diagnostic status report — shows metaswarm installation state, project setup, and potential issues","https:\u002F\u002Fgithub.com\u002FPrekzursil\u002Fagent-skills-toolchain\u002Fblob\u002Fmain\u002Ftools\u002Feditor\u002Fmetaswarm\u002Fskills\u002Fstatus\u002FSKILL.md",[],[134,139,140,141,142,143,144,145],"setup","report","project","installation","project setup","issues","state",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":39},"01M6DF6X6C2XB0P6GX76P7TTYV","start","Use when starting work on any task, when the user mentions metaswarm, or when the user wants to begin tracked development work","https:\u002F\u002Fgithub.com\u002FPrekzursil\u002Fagent-skills-toolchain\u002Fblob\u002Fmain\u002Ftools\u002Feditor\u002Fmetaswarm\u002Fskills\u002Fstart\u002FSKILL.md",[],[148,153,76,154,155,156,80,157,158,159,160],"start issue","issue","ready","work on issue","user","work","work on","development",{"skillNo":162,"name":139,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":39},"01M6DF6QMJ9AJKFKHHKRT005PQ","Interactive project setup — detects your project, configures metaswarm, writes project-local files","https:\u002F\u002Fgithub.com\u002FPrekzursil\u002Fagent-skills-toolchain\u002Fblob\u002Fmain\u002Ftools\u002Feditor\u002Fmetaswarm\u002Fskills\u002Fsetup\u002FSKILL.md",[],[139,141,108,167,143,168],"files","interactive"]