问题
Does anybody aware of a package for "piecewise linear regression" ?
回答1:
You might also want to check out the breakpoints function in the strucchange package. I've used it when I've had an unknown number of breakpoints. It's easy to use and has good documentation.
回答2:
Check out the segmented package
回答3:
there's a function called piecewise.linear
in the SiZer package.
Searching RSeek.org is often a good place to start for instances like this where you want to know if something exists already.
回答4:
Not sure this will help, but what about the package earth that does MARS?
回答5:
There is a M5P method in RWeka package. This is a regression tree with linear equations in leaves. Example code
library("RWeka")
MT_model <- M5P(DEP ~ ., data = my_data)
There are some parameters to be tuned…
MT_model <- M5P(DEP ~ ., data = my_data, control = Weka_control(M = 4, N = FALSE, U = TRUE, R = FALSE))
To see the description of tunning parameters:
WOW('M5P')
But there is also caret package that can tune your parameters automatically.
library(caret)
train(DEP ~ ., data = my_data, method = 'M5')
来源:https://stackoverflow.com/questions/2854513/need-a-r-package-for-piecewise-linear-regression