christophergandrud / christophergandrud/pltesim
btscs(): Spell Counter with Panel Gaps
- Dominant language
- R
- Stars
- 2
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
`btscs()` improperly generates its spell variable when a panel has gaps. It continues counting from the spell variable's previous value, instead of continuing the count _plus_ taking the gap into account.
For a quick toy example:
````r
library(pltesim)
dat <- data.frame(id=c(rep(1,5), rep(2,5)),
year=c(1950, 1951, 1953, 1954, 1955, seq(1950,1954,1)),
event=c(rep(0,10)),
stataBTSCS=c(1,2,4,5,6,1,2,3,4,5)
# ^ if no counter reset desired when gaps present (Stata BTSCS's behavior) -> what I'd expect
)
dat
btscs(dat, "event", "year", "id")
````
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.