BookmarkSubscribeRSS Feed
hellohere
Pyrite | Level 9

I have to dataset with chart below. The Grey Refence Line is x=5021. 

Like run two-step Segment Model, Segmented regression models in SAS - The DO Loop

know how to code/run the segment model without constrain, the one on left (x<=5021) and the other on right(x>5021)?!

How to code/run with constrain?! Or with Proc Reg on two datasets chopped into and to stitch together?! Kind of kidgarden though. 

 

 

 SGPlot1309.png

4 REPLIES 4
hellohere
Pyrite | Level 9

Strictly it is not one regression exactly on left of the reference line, and the other regression exactly on the right of the reference line.

 

What I need is to enforce the second-step in TWO-STEP Segment Regression at the TAIL, RIGHT of the reference line.

It can be reference_line+1, reference_line+10, ... 

Rick_SAS
SAS Super FREQ

It sounds like you are trying to fit a piecewise linear regression model. In a piecewise model, the predicted values before the reference line will be based on one set of parameter estimates (for example, the slope and intercept), and the predicted values after the reference line will have a different set of estimates.

 

In the blog post you referenced, the location of the reference line had to be estimated from the data. That's why it required PROC NLIN. However, for your data, it sounds like you know the location of the breakpoint (x=5021), so you can use linear models from a procedure such as PROC GLM or PROC GLIMMIX. See "Piecewise regression models and spline effects" for a discussion and two examples.

 

hellohere
Pyrite | Level 9

Rick:

 

Thanks for the response.

 

I need two-segmented-regression, with the second one at right of the reference value(greater than).

But it can be > 5300, it can be > 5500 ...

 

So what I need is segment regression with constrain on the 2nd regression on left of the reference value. 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 412 views
  • 0 likes
  • 2 in conversation