Questions tagged [piecewise-linear]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
7 views

Custom contrasts in piecewise mixed effects models

I have longitudinal data from a two-group RCT in which the primary outcome was assessed at baseline, each week during the intervention, post-test and 5-month follow-up (6 times total). I am modeling ...
yeshe's user avatar
  • 11
3 votes
2 answers
173 views

How to combine two linear models?

I am trying to predict housing prices using as few variables as possible. One way that yielded the best results so far is splitting the data into two data-sets ($houses < 100m^2$ and $houses >= ...
Anton's user avatar
  • 31
1 vote
0 answers
19 views

How to model suspected piecewise-linear data with a lasso GLM

My data consist ~130 observations. Each observation has several thousand features (including many collinear or otherwise useless features) and a position along a single spatial dimension. Some sets of ...
Neuromancer's user avatar
0 votes
0 answers
25 views

Can Piecewise Regression Method of Jean Jacquelin be extended to 4 segments?

I want to identify the matris form of general y=f(x) function for: y(x)=p1x+q1 x<a1 =p2x+q2 x<a2 =p3x+q3 x<a3 =p4x+q4 x>a3 where a1,a2,a3,p1,q1,p2,q2,p3,q3,p4,q4 are unknown parameters to ...
Çağlar Özcan's user avatar
0 votes
0 answers
12 views

About Estimating Parameters from Unpaired Datasets

I possess three datasets: $x$, $y$ and $z$. It's hypothesized that a relationship exists between these variables, represented by the equation $z=a*x+b*y$. My goal is to estimate the values of $a$ and $...
JING's user avatar
  • 1
0 votes
0 answers
292 views

Fitting multiple piecewise linear regression model (with hinges)

I am trying to fit a multiple piecewise linear regression model, where I coerce the model to have the exact terms I want. For example, let's say I want to fit the exact model below, with predictors $...
Florent H's user avatar
  • 153
0 votes
1 answer
80 views

Fitting a segmented regression with two zero boundary constraints

I am having trouble with this segmented regression as it requires two constraints and so far I have only treated single constraints. Here is an example of some data I am trying to fit: ...
leonardo's user avatar
8 votes
1 answer
1k views

Difference between Spline and Piecewise Regression

I was looking for the difference between spline regression and piecewise regression. Can someone please explain it to me? Also, if someone can provide me good reference on these 2 topics, with ...
ragas's user avatar
  • 215
1 vote
0 answers
63 views

Including intercept terms in piecewise linear programming

I am hoping to get some help in understanding whether the intercept terms are required in the objective function for piecewise linear programming (using the below code). ...
Marley's user avatar
  • 11
0 votes
1 answer
193 views

How to code time for a piecewise growth model for experimental data

I have data from an experiment that records the effects of stress on blood pressure. The study went as follows: Participants had their blood pressure measured 4 times over ten minutes to assess their ...
aaaa's user avatar
  • 11
1 vote
0 answers
60 views

Piecewise orthogonal regression

I want to fit data points by linear segments. The summed squared orthogonal distance of the points to the fitting lines shall be minimized, preferably using weights for the data points and for a ...
user269684's user avatar
1 vote
1 answer
571 views

Fit points with a continuous, piecewise linear function with minimum number of points for each segment

I have a set of two-dimensional data points that I want to fit with a continuous piecewise linear function with one break point. However, I want each of the two segments to be supported by a minimum ...
frog's user avatar
  • 13
1 vote
1 answer
117 views

Latent growth curve with three latent variable and piecewise linear regression

I already heard about piecewise linear regression but I have no experience with latent growth curves. I came across it in that paper. As far as I understood based on Figure 1 (observed sample means) ...
Mas A's user avatar
  • 181
3 votes
4 answers
4k views

How to detect trend changes in noise time series?

wget -q -O- https://i.stack.imgur.com/xczQ1.gif | tail -c +43 R> with(f, plot(x, log10(y), type='l')) I have a series whose ...
user1424739's user avatar
5 votes
1 answer
661 views

Is there a formal test for model comparison between polynomial regression and piecewise/segmented regression? (i.e., are these models nested?)

I am interested in comparing three models a linear regression model: mod_linear <- lm (dv ~ iv) a polynomial regression model: mod_polynomial <- lm (dv ~ iv + I(iv^2)) a one-breakpoint ...
Annalise's user avatar
  • 107
0 votes
3 answers
295 views

Is there a "canonical" probabilistic version of the step function?

Step and switch-like functions can be thought of as deterministic switches at some threshold, so smooth sigmoidal-like functions describe that switch with uncertainty around that value. The machine ...
caesoma's user avatar
  • 11
4 votes
1 answer
810 views

Generalized Linear Model in a Piecewise SEM?

I have applied a piecewise structural equation model to my data using generalised linear models. I have used the glm() R function along with psem in the "piecewiseSEM" R package. It has ...
Will 's user avatar
  • 161
3 votes
1 answer
781 views

How to fit a piecewise assembly of nonlinear functions?

I am trying to model vegetation spectral signatures (grey lines) using a two-part piecewise function (black dotted lines). In it, I am trying to use only a few points (red dots) to fit a linear (first ...
Gustavo's user avatar
  • 51
2 votes
2 answers
456 views

How do you fix one slope coefficient in an interaction term?

hoping someone can help me with what (on the face of it) appears to be a relatively simple problem but which I can't current code out. Basically, I would like to fit a GLM in R with a simple two-way ...
kernowsam's user avatar
1 vote
1 answer
1k views

In hierarchical regression, the first step is not significant but later steps are

I ran a hierarchical regression comparing different models, in order of complexity. The first step was not significant (the simplest model vs a more complex model). However the next two steps were ...
Annalise's user avatar
  • 107
1 vote
1 answer
218 views

Select model in piecewise regression

How could we compare models fitted with piecewise regression that have different breakpoints? I used the code written here. In the example below, the "best" model, i.e. minimizing the residuals is ...
user3631369's user avatar
0 votes
2 answers
193 views

Simple algorithm to detect change point in time series

Apologies if this question has already been asked, but a lot of similar questions are regarding R or complex algorithms that I don't want. I have numerous 2-dimensional time series, eacch plotting ...
brianmchoi11's user avatar
0 votes
1 answer
997 views

How to do a discontinuos segmented logistic regression in R?

I'm trying to do a discontinuous segmented logistic regression, something like this: https://i.stack.imgur.com/AO1Mh.jpg . The 6 breaking points are predetermined from domain knowledge. Unfortunately ...
user272593's user avatar
1 vote
1 answer
174 views

Don't understand why the first variable in a piecewise regression spans all the domain

Let us consider one predictor $X \in [a,b] \subset \mathbb{R}$ and one response $Y \in \mathbb{R}$. I need to perform a piecewise linear regression: $$ Y \sim \beta_0 + \beta_{1,1} X + \beta_{1,2} (X ...
Andry's user avatar
  • 219
1 vote
0 answers
48 views

Optimal penalty for finding changepoints with the fused lasso, assuming some probabilistic model?

I am interested in detecting changepoints in a signal using the fused lasso (as implemented here for example). I am in particular interested in getting estimates of changepoints which are close to the ...
user54038's user avatar
  • 543
0 votes
0 answers
31 views

Can I set the breakpoint of piecewise regression by medical reference?

I want to prove different regression coefficient for SBP on BMI according to BMI categories. So I want to use piecewise regression. BMI is categorized by WHO guideline which means medicaly proven ...
Koh Heebyung's user avatar
1 vote
2 answers
82 views

Regression: checking effect of negative vs positive regressor

I'm fitting a linear model of the following form: $Y_{i} = \alpha + \beta_1X_{i} + \beta_2Z_{i} + \beta_3X_{i}\times Z_{i}+e_i$ All the variables are continuous. I'm interested in the sign of the ...
Ali Gröch's user avatar
4 votes
3 answers
4k views

Piecewise linear with constraints with the segmented function on R

I want to make a piecewise linear regression in R. I have a large dataset with 3 segments where I want the first and third segment to be without slope, i.e. ...
Cyrielle's user avatar
1 vote
0 answers
99 views

Finding the distribution of a piecewise function of a Gamma random variable

Let random variable $X \sim \text{Gamma}(\alpha,\beta)$. I want to derive the distribution of $Y$, where: $$ Y = \left\{ \begin{array}{ll} a X - k & \quad X \geq \frac{k}{a} \...
DavidL's user avatar
  • 11
1 vote
1 answer
54 views

Censoring linearly splined predictor in regression

I'm developing a logistic regression where one of the independent variables has a non-linear relationship to the probability of the event occurring. I have created linear splines based on this ...
MrT's user avatar
  • 151
6 votes
1 answer
1k views

Position of knots in piecewise linear regression as 'random effects'

TL;DR: Is there some way I can do 'random knots' (where the position of the knot varies according to some group, not the number)? Full question: After obtaining experimental data, I find that one of ...
WavesWashSands's user avatar
3 votes
2 answers
962 views

Piecewise regression vs multiple models

Say you have a piecewise regression model with one breakpoint. Is there any difference between that and just creating a separate simple regression model for each segment of the IV?
Ashish's user avatar
  • 305
2 votes
0 answers
526 views

Understanding the Math of Segmented and Splines2 packages.

I was trying to teach myself the math behind what produces the slope and intercept of a segmented variable in the segmented package using the plant data set. My ...
Jordan 's user avatar
  • 235
3 votes
0 answers
268 views

Looking for references - ReLU neural networks vs Fitting continuous piecewise linear function

ReLU activated neural networks with a linear output are continuous piecewise linear functions (CPLF). There are technuques to fit CPLF functions, so comparison of those methods seems very natural, ...
them's user avatar
  • 690
1 vote
1 answer
230 views

How to adjust the parameters of a Piecewise regression model in Matlab?

I have an existent piecewise regression model correlating the parameters X and Y as follows: If X<0.1, then Y=0.744. If X>=0.1 & X<=0.8, then Y=0.842-0.977*X. If X>0.8, then Y=0.06. The ...
Muhammed A. Zidan's user avatar
1 vote
0 answers
210 views

Finding an inflection point between two conditions

The figure below illustrates a sample data from a numerosity estimation experiment with an uncalibrated (i.e., spontaneous) estimation condition (blue) and a calibrated estimation condition (orange). ...
DJY's user avatar
  • 73
1 vote
1 answer
118 views

How to estimate parameters of a (almost) linear model from unpaired observations?

I have this model: $a_i=mod(\lfloor i\cdot T+Normal(0,\sigma_a)\rfloor,Q)$ $b_i=mod(\lfloor a_i+D+Normal(0,\sigma_b)\rfloor,Q)$ with $i=1..N$ $N\in\mathbb{N}$ $Q\in\mathbb{N}$ $T\in\mathbb{R}, ...
Alessandro Jacopson's user avatar
1 vote
0 answers
98 views

segmented piece wise linear regression problem?

I want to get a piecewise linear regression model with the function "segmented". ...
user163494's user avatar
1 vote
1 answer
616 views

What is the difference between linear interpolation and piece-wise linear interpolation?

I'm familiar with linear interpolation. I tried to search some details about piece-wise linear interpolation but failed to understand this method. Can someone explain the difference between these two ...
YQ.Wang's user avatar
  • 429
4 votes
2 answers
3k views

Sampling from a piecewise linear probability density function

I have a pdf modelled as a piecewise linear function that I can represent as the sequence of pairs of real numbers standing for the points in the of the piecewise line: $\{(x_{1}, y_{1}), \dots, (x_{n}...
rano's user avatar
  • 411
0 votes
1 answer
81 views

piecewise regression into a for loop [closed]

I´m trying get a piecewise regression. ...
Alex's user avatar
  • 3
0 votes
0 answers
522 views

Model with piecewise-linear functions

I have a model which is of the following deterministic form: Y = A + B + C A, B and C are piecewise-linear functions of a, b and c, which are macroeconomic variables. I have the values (nodes, ...
Des's user avatar
  • 31
1 vote
1 answer
597 views

How to find the best piecewise-smooth fit

I have data points $(\theta,y)$ that when plotted in a x-y (with $\theta$ being the x) graph can be fit by the curve $$y=-\alpha-\frac{\beta}{\cos(\theta_{0}-\theta)}$$ i.e. I can find $\alpha, \...
user2175783's user avatar
7 votes
1 answer
3k views

Test for the significance of the effect of an intervention in a time series

I am looking for the best approach to test for the significance of the effect of an intervention that occurred at a known time on a time series data. Using a toy dataset as an example, I have come up ...
Mihail's user avatar
  • 532
6 votes
3 answers
361 views

"Branching Stick" Regression

With piecewise, or so-called broken-stick regression it is possible to fit two lines to data, But what if I wanted to fit data to two lines, one main and one branch which connects to a primary line ...
BBSysDyn's user avatar
  • 1,002
1 vote
0 answers
448 views

Can a Piecewise Linear Regression Approximate a Neural Network?

I have a piecewise linear regression model that performs quite well (CVd) on subsets of a small data set (Ns between 30 and 90 for the subsets, with a total of 222 records). So there are separate ...
WDCR's user avatar
  • 11
2 votes
2 answers
125 views

Estimating failure-point when failed datapoints are unobservable

I have several datasets of two variables, y and time. Datapoints are objects subject to physical wear, and wear-rates are (roughly) constant over the life of the objects. y is defined as the ...
bshane's user avatar
  • 203
1 vote
2 answers
5k views

Determine breakpoints in time series data where values change significantly

Given the following chart of data: which represents duration metrics gathered at absolute times, I am trying to determine when/if any of the values exhibit a jump in durations. In the example chart, ...
Eli's user avatar
  • 111
5 votes
1 answer
2k views

Gaussian Process Regression for piecewise linear response functions

I am performing Gaussian Process Regression (without noise) for response functions which are piecewise linear. My question: Does there exist a covariance function, such that sample paths from a ...
g g's user avatar
  • 2,327
6 votes
3 answers
4k views

Piecewise regression with constraints

I want to make a piecewise linear regression in R. I have a large dataset with 3 segments where I want the first and third segment to be without slope, i.e. parallel to x-axis and I also want the ...
Mats_B's user avatar
  • 61