Date: Fri, 11 Aug 2006 18:28:23 +0200 "adel F." "SAS(r) Discussion" "adel F." RE : Re: Hockey stick models text/plain; charset=iso-8859-1

Thanks a lot, I recently heard about this technique and that is related to "Estimating the transition betwen two interescting straight lines" by D.W. Bacon, Biometrika (1971), 59,3, p 525

Some applications of the hochey is used in the logistic regression, we can fit two logistic regression for each dataset, below the change point and above the change point

Is there any possiblity to identify the change point? or we need to "estimate" this point graphically? Thanks Adel

L Cassell <davidlcassell@MSN.COM> a écrit : kviel@EMORY.EDU replied: > >On Thu, 10 Aug 2006, adel F. wrote: > > > I am looking for a SAS procedure for the Hockey stick models. > > Thanks for help > >Adel, > > Peter Flom mentioned splines. Without being certain, that sounds like a >possibility, which then means a data step and a "standard" procedure >(GENMOD, REG, MIXES, LOGISTIC) will work. > > I have gotten much mileage out of one chapter from "Semiparametric >Regression" by Ruppert, Ward and Carroll. I got the softcover for about >\$40 new. > >Consider: > >data spline ; > set orig ; > x2 = x ** 2 ; > x_50 = ( 0 max ( x - 50 )) ** 2 ; >run ; > >proc reg data = spline ; > model y = x x2 x_50 ; >run ; > > As for the choice and number of knots.... :) > >Good luck, > >Kevin

Just a couple points I'd like to chuck in here:

[1] The data step here might be written as a view.

data spline / view=spline; set orig ; x2 = x ** 2 ; x_50 = ( 0 max ( x - 50 )) ** 2 ; run ;

Now we don't have to keep mutiple copies of the data, or worry about maintaining all data sets if the source data are altered due to QA or new input.

[2] The 'hockey stick' models tend to be really, really simple spline fits. The kind that I did as a project in Stat 101. Hmm. that course was from Ray Carroll, of Ruppert, Ward and Carroll. What a coincidence! Ray may be the only leprechaun to branch out into statistics. :-)

Typically, a true 'hockey stick' model has a linear piece X, an observable knot, and a simple linear spline. You don't need differentiability or anything. So you could simplify the code like this, assuming we first look at the data and decide that 50 would be a good knot:

data spline / view=spline; set orig ; x_50 = 0 max ( x - 50 ) ; run ;

proc reg data = spline ; model y = x x_50 ; run ;

[3] The code "0 max ( x - 50 )" is short and efficent, but it may confuse some readers. For those playing along at home, it is equivalent to:

if x < 50 then x_50 = 0; else x_50 = x - 50;

HTCT, David -- David L. Cassell mathematical statistician Design Pathways 3115 NW Norwood Pl. Corvallis OR 97330

_________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar – get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

--------------------------------- Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet ! Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos expériences. Cliquez ici.

Back to: Top of message | Previous page | Main SAS-L page