Confounding Adjustment

Control time-varying confounders in environmental time series analyses using R.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/ntluong95/agent-skills-statistics --skill confounding-adjustment
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Confounding Adjustment
Source: https://github.com/ntluong95/agent-skills-statistics/tree/main/skills/epidemiology/confounding-adjustment
Command: npx skills add https://github.com/ntluong95/agent-skills-statistics --skill confounding-adjustment

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the critical challenge of controlling for time-varying confounders in environmental time series studies, ensuring more accurate estimations of exposure-health relationships.

Core Features & Use Cases

  • Trend and Seasonality Adjustment: Implements flexible splines (ns()) to model and remove long-term trends and seasonal patterns.
  • Meteorological Confounder Control: Provides methods for adjusting for temperature and humidity using natural splines or cross-basis functions.
  • Calendar Effect Integration: Includes options for incorporating day-of-week, public holidays, and other calendar-related factors.
  • Use Case: When analyzing the impact of air pollution on respiratory hospital admissions, this Skill helps adjust for daily temperature fluctuations and yearly seasonal trends that could otherwise bias the pollution effect estimate.

Quick Start

Use the confounding adjustment skill to control for a long-term trend and seasonality using 7 degrees of freedom per year in your R model.

Frequently Asked Questions about Confounding Adjustment

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I adjust for time-varying confounders in environmental time series data using R?

Model long-term trends and seasonality in R time series using natural splines with 7 degrees of freedom per year to control for time-varying confounders like temperature, humidity, and calendar effects in environmental epidemiology analyses.

What is the best way to control seasonality and long-term trends in epidemiological time series?

Control seasonality and long-term trends in epidemiological time series by fitting flexible natural splines and cross-basis functions to remove temporal patterns, ensuring accurate estimation of exposure-health relationships.

Can I use natural splines and cross-basis functions for meteorological confounder control?

Yes, you can use natural splines or cross-basis functions in R to adjust for meteorological confounders like temperature and humidity, ensuring accurate exposure-health effect estimation in time series analyses.

Does confounding adjustment handle calendar effects like day of week and public holidays?

Yes, confounding adjustment includes options for incorporating day-of-week, public holidays, and other calendar-related factors directly into the environmental time series model to remove calendar effect bias.

Why does my time series model still show residual autocorrelation after adjusting for seasonality?

Residual autocorrelation after adjusting for seasonality indicates incomplete confounding control; perform residual autocorrelation checks and periodogram analysis to verify that trend, seasonality, and meteorological adjustments are adequate.