BookmarkSubscribeRSS Feed
MisterFred
Fluorite | Level 6

Hi Everyone,

I've red an article on the response of pigs to increasing concentrations of isoleucine in their diet. The response was analysed with proc nlin. It is said in the article that they modified the classical broken-stick (or linear-plateau) model into a bentstick model.

I know how to program a broken-stick model but I really don't know how to do with a bent-stick model. In the article the bent-stick model is based on two line segments that are connected by a quadratic function, resulting in a smooth transition between both line segments. So it seems to be a modification of a broken stick model.ent_stick

Does any one can help me please ?

Thanks

Friedrich

4 REPLIES 4
SteveDenham
Jade | Level 19

Example 63.1 Segmented Model in the NLIN Procedure documentation will get you started.  This is a linear plateau following a quadratic.  What you want is linear-quadratic-linear.  Start by writing the expectation across all X, then apply the continuity and smoothness conditions.

It might be better to fit a spline to the data, with four knots, corresponding to the two ends and the two join points, or a thin-plate spline that accommodates the design.

Steve Denham

MohammadFayaz
Calcite | Level 5

Hello.

A very good proc nlin example is in the following link

Regression - hockey sticks, broken sticks, piecewise, change points

MisterFred
Fluorite | Level 6

Hi Steve and Mohammad,

Thanks a lot for you answers.

I've used the piecewise regression and applied Steve's advice (expectation across all X + continuity and smoothness).

So I've 3 equations :

  1. when X<X1 Y=a1+b1X
  2. when X1<X<X2 Y=a2+b2X+c2X²
  3. when X>X2 Y= a3+b3X

which gives :

ods graphics on;

Proc nlin data=Essai_segmentedLQL noitprint plots=(diagnostics fitplot);

parms a1=1 b1=1 b2=1 b3=1 c2=1 X1=10 X2=20;

if (X<=X1) then mean = a1+b1*X;

else

if (X>X1 AND X<=X2) then mean = a1+X1*(b1-b2)+b2*X+c2*(X*X-X1*X1);

else mean = a1+X1*(b1-b2)+X2*(b2-b3)+c2*(X2*X2-X1*X1)+b3*X;

model Y = mean;

run;

ods graphics off;

It seems to work quite well. There's just an issue with the start parameters. I have to estimate graphically the breakpoints. It is not a problem with one set of data, but it is if I want to run several regression with quite different parameters values. But I think I can handle this.

Thank again for you help.

Friedrich

MohammadFayaz
Calcite | Level 5

Can you write some macros for this ?

This paper may give you some ideas:

http://www.nesug.org/proceedings/nesug04/ap/ap04.pdf

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 2793 views
  • 6 likes
  • 3 in conversation