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;
- Stata Commands: -nl-, -svy nl-, -ml-
- Stata Commands: -mkspline- creates variables containing a linear spline or a restricted cubic spline of a variable, and makes it easy to create the new variables for piecewise regression models.
- Example 1 - continuous dependent variable:
- .use http://www.stata-press.com/data/r12/mksp1
- .mkspline age1 20 age2 30 age3 40 age4 50 age5 60 age6 = age, marginal
- .regress lninc educ age1-age6, vce(robust) //with knots only
- .gen agegt20=(age>=20)
- .regress lninc educ age1 age2 agegt20, vce(robust) //with one knots and one jump
- Example 2 - dichotomous dependent variable:
- .use http://www.stata-press.com/data/r12/mksp2
- .mkspline dose 5 = dosage, displayknots
- .logistic outcome dose1-dose5
- Stata: How can I find where to split a piecewise regression?
- Stata: How can I run a piecewise regression in Stata?
- Stata STB: Piece-wise exponential survival models.
- Stata STB: The piecewise linear spline transformation 27-29(pdf).
- Stata Journal: Multivariable modeling with cubic regression splines: A principled approach (pdf)
- Stata/SPSS: Nonlinear relationships (pdf)
- Stata FAQs: Nonlinear regression; How can I use Stata to solve a system of nonlinear equations?
- Stata FAQs: How do I estimate a nonlinear model using -ml-?
- Stata (UCLA): Simple linear and nonlinear models using Stata's -ml- command.
- I think Chow Test and Generalized Additive Model (GAM) [Wikipedia, StatSoft, an article of Hastie and Tibshirani(pdf)] have the similar concepts.
- Software: Stata (GAM), SAS (PROC GAM, tutorial (pdf)), R (gam).
- R!: R for Ecologists: Putting Together a Piecewise Regression (2012)
- SAS: A tutorial on the piecewise regression approach applied to bedload transport data (pdf)
- SAS(Rick Wicklin):Segmented regression models in SAS
- SAS(Rick Wicklin): Nonsmooth models and spline effects, Shared Concepts and Topics: EFFECT, ESTIMATE
- NCI: Joinpoint Regression Software
No comments:
Post a Comment