Add piecewise regression example
See original GitHub issueWe can define
def truncate(x, l):
x = (x - l) * (x >= l)
return x
And then simply do
formula = "response ~ x + truncate(x, 10) + truncate(x, 20)"
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
How to Perform Piecewise Regression in R (Step-by-Step)
This tutorial explains how to perform piecewise regression in R, including a step-by-step example.
Read more >8.8 - Piecewise Linear Regression Models | STAT 501
Let's start with an example that demonstrates the need for using a piecewise approach to our linear regression model. Consider the following plot...
Read more >R for Ecologists: Putting Together a Piecewise Regression
To use this method, you first fit a generic linear model. You then use the segmented( ) function to fit the piecewise regression....
Read more >2 Piecewise Regression and Splines - Bookdown
2.1 Introduction. An alternative to fit all data points with a single polynomial curve, is to fit segments to different parts of the...
Read more >Piecewise Linear Regression Model. What Is It and When Can ...
The problem of polynomial regression is that you lose the interpretability of the model when adding the polynomial terms (quadratic, cubic, etc) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I like when people get involved in the issues and propose new ideas. I really appreciate your comments. So please feel free to share when you want to propose something.
To be a little clearer, I’m not saying that we should only have the example using
truncated()
. What I’m saying is that we could have both, and explain the connection between them 😉Fair points. I appreciate that my proposition might be a tad bullish regarding people’s familiarity with splines use.