R語言如何使用segmented包求拐點
R語言如何使用segmented包求拐點?
ibeautiful
2019-02-07 11:07:27
TA貢獻1806條經驗 獲得超8個贊
可以查看segmented包求拐點的例子。
R中運行:
library(segmented)
?segmented
。。。。。。
#An example using the default method:
# Cox regression with a segmented relationship
## Not run:
library(survival)
data(stanford2)
o<-coxph(Surv(time, status)~age, data=stanford2)
os<-segmented(o, ~age, psi=40) #estimate the breakpoint in the age effect
summary(os) #actually it means summary.coxph(os)
plot(os) #it does not work
plot.segmented(os) #call explicitly plot.segmented() to plot the fitted piecewise lines
如圖,拐點已求出。
舉報