开发者

Need a R package for piecewise linear regression? [closed]

开发者 https://www.devze.com 2022-12-30 09:55 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

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 question

Is 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')
0

精彩评论

暂无评论...
验证码 换一张
取 消