ps_spells() allows you to create spells ("peace years" in
the international conflict context) between observations of some event. This
will allow the researcher to better model temporal dependence in binary time-series
cross-section ("BTSCS") models. The function is one of three in this package, and the contents
of this function are partly ported from the add_duration() function in the spduration
package. That function, unlike the other two I offer here, works much better where panels are decidedly
imbalanced.
Arguments
- data
the data set with which you are working
- event
some event (0, 1) for which you want spells
- tvar
the time variable (e.g. a year)
- csunit
the cross-sectional unit (e.g. a dyad or leader)
- time_type
what type of time-unit are the data? Right now, this will only work with years but support for months and days are forthcoming. Don't do anything with this argument just yet.
- ongoing
If
TRUE, successive 1s are considered ongoing events and treated asNAafter the first 1. IfFALSE, successive 1s are all treated as failures. Defaults toFALSE.
Details
This function is derived from add_duration() in the spduration
package. See documentation there for more information. I thank Andreas Beger for the blessing to port parts of
it here.