我的数据:
require(segmented)
y <- 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)
x <- c(1443991015, 1443994615, 1443998215, 1444001815, 1444005415, 1444009015, 1444012615, 1444016215, 1444019815, 1444023415, 1444027015, 1444030615, 1444034215, 1444037815, 1444041415,
1444045015, 1444048615, 1444052215, 1444055815, 1444059415)
nb:x数据是POSIXct日期,现已转换为“数字”格式。
我的线性模型:
lin.mod <- lm(y ~ x)
输出:
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
-2.201e+02 1.525e-07
现在,我想查找断点是否存在
我愿意
segmented.mod <- segmented(obj = lin.mod, seg.Z = ~x, psi = 11)
但是我给我这个错误消息:
Error in segmented.lm(obj = lin.mod, seg.Z = ~dates, psi = 11) :
starting psi out of the admissible range