Conversation
Owner
Author
|
With this you would be able to use fomulae to define models for linear regressions. A good (orthogonal) import numpy as np
import pandas as pd
from plotine import *
n = 100
np.random.seed(123)
mu = 0
sigma = 15
noise = np.random.randn(n)*sigma + mu
def poly(x, degree=1):
"""
Fit Polynomial
These are non orthogonal factors, but it may not matter if
we only need this for predictions (without interpreting the
coefficients) or visualisation.
"""
d = {}
for i in range(degree+1):
if i == 1:
d['x'] = x
else:
d[f'x**{i}'] = np.power(x, i)
return pd.DataFrame(d)
x = np.linspace(-np.pi, np.pi, n)
df = pd.DataFrame({
'x': x,
'y': (x + x**2 + 7*x**3) + noise
})
(ggplot(df, aes('x', 'y'))
+ geom_point()
+ stat_smooth(method='lm', formula='y ~ poly(x, degree=3)', fill='red', se=True)
) |
Contributor
|
@has2k1 I see that your PR to statsmodels (6152) has been merged and statsmodels 0.11 released. Is there anything else holding this one out? Could we help in any way? |
Owner
Author
|
@krassowski, with the release of statsmodels v0.11 then this PR will get merged. |
ci - Confidence Intervals
- Bump patsy to v0.5.1 - Bump pandas to latest version (v1.0.3) Ref: #314
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

closes #311