You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hope you don't mind me reaching out via Github issue regarding your btscs() function. I use it quite a lot in my {stevemisc} package and figuring out how to disentangle this function got me into the R package development world. I thank you for it.
I wanted to reach out with an inquiry regarding your btscs() function since it (and my wrapper for it) are running into the same problem. I don't know how best to describe it, but simply: if I have a state-year data frame from 1946 to 2020, but only conflict data from 1946 to 2019, this function will fail to calculate the peace years/spells altogether.
Here is a proof of concept using the aclp data. The data end in 1990. If we were to calculate the spells, this function does just fine. If we were to add another year (1991) for those states still active in 1990, the function fails with the message "missing value where TRUE/FALSE needed". If, say, the spells were needed for adjusting temporal dependence for the outcome (as is usually the case), the data (in this case and in the trouble I'm encountering in my data) should be subset to just the relevant event years and it would be fine. But, I'm wondering if there's a way to make this function more flexible so that it might see the all-NAs after the last year of events and still work.
library(DAMisc)
library(tidyverse)
data(aclp)
# convert to tibble for convenienceaclp<- as_tibble(aclp)
# Add 1991, but no event "democ" observationsaclp %>%
filter(year==1990) %>%
distinct(cname,country) %>%
mutate(year=1991) %>%
bind_rows(., aclp) %>%
arrange(country, year) ->aclp2succeeds<- btscs(aclp, "democ", "year", "country")
fails<- btscs(aclp2, "democ", "year", "country")
Any input appreciated, and thank you again.
The text was updated successfully, but these errors were encountered:
Writing with a follow-up since I realize I'm not that smart and should have checked this before submitting the issue, but the pad.ts = TRUE argument would nominally fix this. Maybe I had just misunderstood what that argument was doing.
Hi Dave,
I hope you don't mind me reaching out via Github issue regarding your
btscs()
function. I use it quite a lot in my{stevemisc}
package and figuring out how to disentangle this function got me into the R package development world. I thank you for it.I wanted to reach out with an inquiry regarding your
btscs()
function since it (and my wrapper for it) are running into the same problem. I don't know how best to describe it, but simply: if I have a state-year data frame from 1946 to 2020, but only conflict data from 1946 to 2019, this function will fail to calculate the peace years/spells altogether.Here is a proof of concept using the
aclp
data. The data end in 1990. If we were to calculate the spells, this function does just fine. If we were to add another year (1991) for those states still active in 1990, the function fails with the message "missing value where TRUE/FALSE needed". If, say, the spells were needed for adjusting temporal dependence for the outcome (as is usually the case), the data (in this case and in the trouble I'm encountering in my data) should be subset to just the relevant event years and it would be fine. But, I'm wondering if there's a way to make this function more flexible so that it might see the all-NAs after the last year of events and still work.Any input appreciated, and thank you again.
The text was updated successfully, but these errors were encountered: