Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Maarten buis <maartenbuis@yahoo.co.uk> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: piece-wise logistic regression |
Date | Wed, 28 Apr 2010 07:56:58 +0000 (GMT) |
--- On Wed, 28/4/10, Jason Ferris wrote: > I have been reading on piecewise regression in stata from > www.ats.ucla.edu/stat/stata/faq/piecewise.htm > > I am interested in approaching some analysis where the > outcome is binary and the predictor is continuous. A lowess > curve of the data seems to indicate a kick in my data with a > positive slope between 1 and 10 and a negative slope from 10 to 80. > > Can I use the same approach mentioned in the website above > for logistic piecewise regression? Yes you can. Consider the example below. You would interpret the results as: Someone works only 12 hours a week has an odds of being a union member of .19, that is, whithin this category we expect .19 union members for every non-union member. As long as someone works less than 40 hours a week, this odds increases by a ratio of 1.02 for every hour increase in working time, that is, an increase in the odds of union-membership of 2% per hour increase. When someone works more than 40 hours the ratio change for a hour increase in working time is .999, that is -.1%, but this change is not significant. *---------- begin example --------------- sysuse nlsw88, clear // A 12 hour job (i.e. 1.5 day) is in my // country the minimum duration for not // being counted unemployed, so in that // case it represents a natural origin replace hours = hours - 12 // 28 + 12 = 40, i.e. full time mkspline hours1 28 hours2=hours // make the baseline odds visible gen byte baseline = 1 logit union hours1 hours2 baseline, or nocons *--------- temporary end example ------------ (For more on examples I sent to the Statalist see: http://www.maartenbuis.nl/example_faq ) Some people like more smooth curves, in that case you can use the restricted cubic spline. The interpretation of the numbers can be a bit harder. Interpretation is than often easier with graphs, e.g. those created by -postrcspline-, which you can download by typing in Stata -ssc install postrcspline-. So continuing the example, We see (the left graph) that the probability of union membership starts at about 10% and increases to a bit less than 30%, but the rate of increase (i.e. the effect of working hours) is clearly less for higher working hours. In the right graph we see that this effect starts at .5% (=100%*.005) and decreases to about 0. *----- continuation from previous example ------ ssc install postrcspline mkspline2 chours = hours, nknots(3) cubic logit union chours1 chours2 baseline, or nocons adjustrcspline, name(pr, replace) mfxrcspline, yline(0) name(dprdx, replace) graph combine pr dprdx, ysize(3) *---------------- end example ------------------- (For more on examples I sent to the Statalist see: http://www.maartenbuis.nl/example_faq ) Hope this helps, Maarten -------------------------- Maarten L. Buis Institut fuer Soziologie Universitaet Tuebingen Wilhelmstrasse 36 72074 Tuebingen Germany http://www.maartenbuis.nl -------------------------- * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/