Monday, December 19, 2011

Piece-wise Regression

Tips: Piecewise/Segmented Regression Related
  • Ryan SE, Porth LS (2007). A tutorial on the piecewise regression approach applied to bedload transport data.(pdf) A very good tutorial article from U.S. Forest Service.
  • Nonlinear relationships
    • additivity vs. non-additivity, linearity vs. non-linearity.
    • a few types of non-linearity modeling: polynomial models, exponential models, piecewise regression models 
  • Example(Stata vs. SAS): If we are looking for the relation of AGE and BMI. Visually there is a reflection/change point/break point at age around 65. We may create two regression: BMI=a1 + b1*AGE for persons age<65, and BMI=a2 + b2*AGE for persons age >= 65. To make the regression continuous at the reflection point: a1 + b1*(age = 65) = a2 + b2*(age = 65), so a2 = a1 + (age=65)*(b1 - b2).
    • Stata: .nl (BMI = cond(AGE < {k}, {a1} + {b1}*AGE, {a1} + {k}*({b1} - {b2}) + {b2}*AGE)), initial(a1 1 b1 1 b2 1 k 60) // here k = reflection point of age,  {} = name of expected parameters of the model.
    • SAS: PROC NLIN; PARMS a1=1 b1=1 b2=1 k=60; IF AGETHEN DO; MODEL BMI=a1 + b1*AGE; END; ELSE IF AGE>=k THEN DO; MODEL BMI=a1 + k*(b1 - b2) + b2*AGE; END; RUN;


      No comments: