stat-fit-glm
Fit a generalized linear model (Poisson, Binomial, or Gaussian family) for count or non-normally distributed outcome data.
- License 许可
- MIT
- 最近更新
- 2026-11-03
- Stars
- ★ 4
- Forks
- 1
01 前言 Front Matter
- name
- stat-fit-glm
- description
- Fit a generalized linear model (Poisson, Binomial, or Gaussian family) for count or non-normally distributed outcome data.
02 资源文件 3
- 参考文档agents/claude.yaml344 B
- 参考文档agents/openai.yaml345 B
- 参考文档config.yaml293 B
03 SKILL.md 正文
Skill: Generalized Linear Model
Use When
- User has count data (e.g., read counts, event counts) requiring Poisson or negative binomial regression
- User has a proportion or binary outcome requiring binomial regression
- User wants a unified framework for regression across different data distributions
- Use cases: RNA-seq count modeling, species abundance counts, clinical event rates
Inputs
- Required:
- Data table (CSV or TSV) with a response variable and one or more predictor columns
- Response variable name
- Predictor variable name(s)
- GLM family:
poisson,binomial, orgaussian
- Optional:
- Link function: default per family (
logfor Poisson,logitfor Binomial,identityfor Gaussian) - Offset variable name (for Poisson rate models, e.g., log library size)
- Check overdispersion:
true(default for Poisson) - Output directory (default:
./glm_output)
- Link function: default per family (
Workflow
- Read data; validate that response variable is compatible with the specified family (non-negative integers for Poisson, 0/1 or proportions for Binomial).
- Fit GLM using the specified family and link function.
- If Poisson: test for overdispersion (dispersion statistic). If overdispersed, automatically refit with quasi-Poisson or negative binomial and report.
- Report for each coefficient: estimate (on link scale), standard error, z-statistic, p-value, exponentiated estimate (rate ratio for log link, odds ratio for logit link) with 95% CI.
- Report model fit: null deviance, residual deviance, AIC, degrees of freedom.
- Generate diagnostic plots: residuals vs. fitted (Pearson residuals), Q-Q plot of deviance residuals.
- Write results table (TSV), model summary (text), and diagnostic plots (PDF) to output directory.
- Report overdispersion finding and family choice justification.
- Save the executable analysis script (
analysis_code.pyoranalysis_code.R) and software version manifest (session_info.txt) used to produce results.
Output Contract
- Coefficient table (TSV): term, estimate, std_error, z_statistic, p_value, exp_estimate, ci_lower, ci_upper
- Model fit summary (TSV): family, link, null_deviance, residual_deviance, aic, df_residual
- Diagnostic plots (PDF)
- Overdispersion test result (Poisson only, printed to stdout)
- Reproducibility artifacts:
analysis_code.pyoranalysis_code.R, plussession_info.txt
Limits
- Negative binomial GLM is preferred over Poisson when count data is overdispersed (common in RNA-seq — use DESeq2 instead for that use case).
- Binomial GLM requires the response to be a proportion [0,1] or a two-column success/failure matrix for aggregated data.
- Does not handle zero-inflated data; use hurdle or zero-inflated models separately.
- Common failure: passing a continuous response with Poisson family — verify data type before running.
04 同仓库更多 Skills
structured-intelligence-skill-creator
Create or update repository skills that conform to local templates, provider metadata requirements, registry rules, and validation workflows.
stat-survival-analysis
Estimate and compare survival functions using Kaplan-Meier curves and log-rank test, with optional Cox proportional hazards regression.
stat-pca
Perform PCA on a numeric data matrix to reduce dimensionality, visualize sample structure, and identify top contributing features.
stat-pairwise-correlation
Compute pairwise correlations and significance tests across all numeric variables, and produce a correlation heatmap.
stat-nonlinear-embedding
Embed high-dimensional data into 2D using t-SNE or UMAP for exploratory visualization of sample or cell relationships.
stat-logistic-regression
Fit a logistic regression model for binary outcomes, report odds ratios and model performance (AUC-ROC, confusion matrix).