agentleFS
Scientific-ToolingScientific-Tooling/structured-intelligence/skills/stat-fit-linear-model/SKILL.md

stat-fit-linear-model

Skill4 starsChanged 12 days agoMITView on GitHub

Fit a linear regression model, report coefficients and model fit, and generate residual diagnostic plots.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use cases include: gene expression vs.

    line 13
  2. Distinctive:

    Read data; validate that response and predictor columns exist and are appropriate types.

    line 28
  3. Distinctive:

    Test regression assumptions: normality of residuals (Shapiro-Wilk), homoscedasticity (Breusch-Pagan), absence of influential points (Cook's …

    line 34
  4. Distinctive:

    Write results table (TSV), model summary (text), and diagnostic plots (PDF) to output directory.

    line 35
  5. Distinctive:

    Does not handle multicollinearity automatically.

    line 49
  6. Very specific:

    Not suitable for count data, binary outcomes, or data with heavy censoring — use stat-fit-glm instead.

    line 50

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: Linear Regression Modeling

Use When

  • User wants to model the linear relationship between a continuous outcome and one or more predictors
  • User needs coefficient estimates, confidence intervals, and p-values for each predictor
  • User wants to assess model fit (R², adjusted R²) and check regression assumptions
  • Use cases include: gene expression vs. age, protein concentration vs. metabolic rate, any dose-response relationship

Inputs

  • Required:
    • Data table (CSV or TSV) with a numeric response variable and one or more numeric or categorical predictor columns
    • Response (outcome) variable name
    • Predictor variable name(s)
  • Optional:
    • Interaction terms (e.g., var1:var2)
    • Standardize predictors: true or false (default: false)
    • Output directory (default: ./lm_output)

Workflow

  1. Read data; validate that response and predictor columns exist and are appropriate types.
  2. Encode categorical predictors as dummy variables (reference level = first alphabetical level).
  3. Fit the linear model: response ~ predictors using ordinary least squares.
  4. Report for each coefficient: estimate, standard error, t-statistic, p-value, 95% confidence interval.
  5. Report model fit: R², adjusted R², F-statistic, overall p-value, AIC, BIC.
  6. Generate residual diagnostic plots: (a) residuals vs. fitted, (b) Q-Q plot of residuals, (c) scale-location, (d) Cook's distance.
  7. Test regression assumptions: normality of residuals (Shapiro-Wilk), homoscedasticity (Breusch-Pagan), absence of influential points (Cook's distance > 4/n).
  8. Write results table (TSV), model summary (text), and diagnostic plots (PDF) to output directory.
  9. Save the executable analysis script (analysis_code.py or analysis_code.R) and software version manifest (session_info.txt) used to produce results.

Output Contract

  • Coefficient table (TSV): term, estimate, std_error, t_statistic, p_value, ci_lower, ci_upper
  • Model fit summary (TSV): r_squared, adj_r_squared, f_statistic, f_p_value, aic, bic, n
  • Residual diagnostic plots (PDF, 4-panel)
  • Assumption test results (printed to stdout)
  • Reproducibility artifacts: analysis_code.py or analysis_code.R, plus session_info.txt

Limits

  • Assumes linearity, independence, homoscedasticity, and normality of residuals — check diagnostic plots.
  • Does not handle multicollinearity automatically; check VIF (variance inflation factor) separately if many predictors.
  • Not suitable for count data, binary outcomes, or data with heavy censoring — use stat-fit-glm instead.
  • Common failure: near-perfect multicollinearity among predictors causes singular matrix error.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.