我的数据:
require(segmented)
cp <- c(0.079, 0.079, 0.079, 0.080, 0.080, 0.081, 0.081, 0.081, 0.081, 0.081, 0.081, 0.082, 0.083, 0.084, 0.086, 0.088, 0.088, 0.088, 0.088, 0.088)
dates <- c(1443991015, 1443994615, 1443998215, 1444001815, 1444005415, 1444009015, 1444012615, 1444016215, 1444019815, 1444023415, 1444027015, 1444030615, 1444034215, 1444037815, 1444041415,
1444045015, 1444048615, 1444052215, 1444055815, 1444059415)
我将测试断点的出现。因此,我按照建议的here进行了Davies.test:
davies.test(lm(cp ~ dates), seg.Z = ~ dates)
但是它返回p值= NA:
Davies' test for a change in the slope
data: formula = cp ~ dates , method = lm
model = gaussian , link = identity
segmented variable = dates
= , n.points = 0, p-value = NA
alternative hypothesis: two.sided
答案 0 :(得分:2)
看来davies.test
无法处理该范围的值;内部发生某种溢出。
dd <- scale(dates)
davies.test(lm(cp ~ dd), seg.Z = ~ dd)
似乎可以正常工作。