We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 months ago.
开发者_运维问答 Improve this questionIs anybody aware of a package for piecewise linear regression?
Check out the segmented package
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.
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.
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')
精彩评论