This function creates a matrix specifying for each state (given in row) to which state we fall when the event given in column happens.
Character. The vector of all possible events.
Logical matrix. Specifying the events to forget once a given event has occurred.
List. Same as
Character. Name of the first state, before any event has occurred.
This function creates a matrix with in each cell the new state which results when the column event (column name) occurs while we are in the corresponding row state (row name). Such a matrix is required by
By default, a new state is created for each combination of events that already has occurred.
dropList allow to specify which events should be "forgotten" once a given event has occurred.
For instance, we may want to forget the "marriage" event once the event "divorce" has occurred.
dropMatrix specifies for each event given in row, the previous events, given in column that should be forgotten.
dropList uses a list to specify the same things. The form is list(event1=c(..., events to forgets), event2=c(..., events to forgets)).
See example below.
This function is a pre-release and further testing is still needed, please report any problems.
Ritschard, G., Gabadinho, A., Studer, M. & M<c3><bc>ller, N.S. (2009), "Converting between various sequence representations", In Ras, Z. & Dardzinska, A. (eds) Advances in Data Management. Series: Studies in Computational Intelligence. Volume 223, pp. 155-175. Berlin: Springer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## Achieving same result using dropMatrix or dropList. ## List of possible events. events <- c("marr", "child", "div") dm <- matrix(FALSE, 3,3, dimnames=list(events, events)) dm[3, ] <- c(TRUE, TRUE, FALSE) dm[1, 3] <- TRUE ## Using the matrix, we forget "marriage" and "child" events when "divorce" occurs. ## We also forget "divorce" after "marriage" occurs. print(dm) stm <- seqe2stm(events, dropMatrix=dm) ## Get same result with the dropList argument. stmList <- seqe2stm(events, dropList=list("div"=c("marr", "child"), "marr"="div")) ## test that the results are the same all.equal(stm, stmList)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.