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 件 担当者 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 を短くまとめたダイジェスト。