bfast2 / bfast2/strucchangeRcpp
Error in my.RSS.table[as.character(i), 3:4] <- c(pot.index[opt], break.RSS[opt]) : replacement has length zero
- Lingua principale
- R
- Stelle
- 6
- Fork
- 5
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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)
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Start by reproducing the reported breakpoints() call with the attached CSV, using bfastpp() and bfastts() as shown. Trace how recresid(), X1, break.RSS, and opt produce the NaN and empty replacement; done means the example no longer fails with a replacement-length error and the behavior for this edge case is covered by a regression test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- r
- Ambito
- data
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100