Search code examples
rtraminer

How to configure begin and end date of SPELL in TraMineR


In the SPELL format of TraMineR, for a given individual i, should end date at t and start date at t+1 be the same or incremented by 1?

My dataset is built this way:

id | start  |   end   | state
1  | 2/1/12 | 3/6/12  | "a"
1  | 3/6/12 | 1/14/13 | "b"
1  | 1/14/13| 2/2/13  | "c"

Should I add 1 day to each start beginning at row 2?


Solution

  • The seqformat function of TraMineR expects integer values as begin and end arguments. If you provide dates, their corresponding integer values will be considered.

    Now, seqformat has an overwrite argument that permits to control the handling of overlaps. By setting overwrite = FALSE, you get the results that you would obtain by adding 1 day to the start values of your second and third rows. With the default overwrite = TRUE, the most recent episode overwrites the older one when they overlap.