turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Bent-stick model with proc nlin

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-20-2013 10:45 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to MisterFred

11-20-2013 02:51 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to MisterFred

11-22-2013 10:18 AM

Hello.

A very good proc nlin example is in the following link

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to MisterFred

11-25-2013 08:00 AM

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 :

- when X<X1 Y=a1+b1X
- when X1<X<X2 Y=a2+b2X+c2X²
- 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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to MisterFred

11-25-2013 08:05 AM

Can you write some macros for this ?

This paper may give you some ideas: