Need a R package for piecewise linear regression?

有些话、适合烂在心里 提交于 2020-01-23 01:18:45

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!