statsmodels / statsmodels/statsmodels

predict does not attempt to invert transformations to left hand side

Open
#1,449 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

comp-regression design
Dominant language
Python
Stars
11.6k
Forks
3.6k
Avg merge
7h 37m
Merged PRs (30d)
96

Description

Let's say I have a model like this:

model = "log(y) ~ s"
fit = ols(model, data=data).fit()

Presumably I am trying to predict y from s. I am taking the log of the left hand side so that I believe that I now have a linear model. Ultimately though, I want the forecast value of y for a given value of s.

If I use fit.predict(s), what I am given are predictions for log(y) as opposed to y itself. Is there any way (for some subset of transformations for which the inverse is known) to tell the predict that I would like to predict y? Something like: fit.predict(s, 'y')

Contributor guide

Open the contributing guide

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 at the fit.predict entry point and trace how the formula model="log(y) ~ s" is represented during prediction. Determine which left-hand-side transformations could have a known inverse, then define and test behavior for requesting predictions on the original y scale. Done means supported transformations return y-scale forecasts without changing the existing default behavior.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.