pydata / pydata/patsy

Better contrast specification

Open
#29 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
990
Forks
106
Avg merge
7d 34m
Merged PRs (30d)
1

Description

Two possible improvements in how we work with contrasts:

  • (minor) Maybe we should have a way to specify a contrast symbolically, like linear_constraint but just the linear part, not the = constant part.
  • (major) There should be some way to specify contrasts and constraints in terms of predictions (which are invariant wrt coding), rather than predictors (betas). Like it should be possible to say "the difference between an item with a=1 and an item with a=2", and the model will spit out a matrix encoding this -- or, crucially, if the model has an interaction between a and b, then it will say "that's not estimable, you can't leave b unspecified". Possibly we also want to be able to say "tell me the derivative of the prediction wrt x1", since that's also one of the things that betas encode.

Syntax for this will be tricky. Possibly just an array of weights + a list of data dicts?

I need to brush up on the estimable contrast literature...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing linear_constraint entry point and the contrast-related API, then read the estimable contrast literature referenced in the issue. Before implementation, resolve whether the scope includes symbolic linear parts, prediction-based contrasts, interaction estimability checks, and prediction derivatives; done means an agreed syntax and behavior for the selected cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.