bfast2 / bfast2/strucchangeRcpp

Error in my.RSS.table[as.character(i), 3:4] <- c(pot.index[opt], break.RSS[opt]) : replacement has length zero

未关闭
#2 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
R
星标
6
派生
5
PR 合并指标
30 天内没有已合并 PR

描述

This is a very odd edge case. With a specific `h` value and specifically when using both `trend` and `harmon` components of `bfastpp`, for specific data, I get the error:
```
Error in my.RSS.table[as.character(i), 3:4] <- c(pot.index[opt], break.RSS[opt]) :
replacement has length zero
```
Also a lot of warnings about `sqrt()` producing `NaN` values. Looks like that line fails because `opt` is an `integer(0)`, and that is because `break.RSS` is a single `NaN` (which probably comes from the `sqrt` problem, which in turn comes from `fr` in `recresid` being a negative value, which comes from `X1` having negative values, and I don't know what `X1` stands for).

To reproduce, see attached CSV, and then run the code:
```r
breakpoints(formula(response~trend+harmon), data=
bfastpp(bfastts(CSV$evi, CSV$time), "irregular"), order=3), h=46)
```

[bug.txt](https://github.com/appelmar/strucchange/files/2495275/bug.txt)

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先使用附加的 CSV,按照所示方式调用 bfastpp() 和 bfastts(),重现报告的 breakpoints() 调用。跟踪 recresid()、X1、break.RSS 和 opt 如何产生 NaN 和空替换;当该示例不再因替换长度错误而失败,并且该边界情况的行为已由回归测试覆盖时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
r
领域
data
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。