Compute transition rates between states

Description

Returns a matrix with transition rates between states, computed from a set of sequences.

Usage

1
2
 seqtrate(seqdata, statl=NULL, time.varying=FALSE, weighted=TRUE,
         lag=1, with.missing=FALSE)

Arguments

seqdata

a sequence object as defined by the seqdef function.

statl

a list of states or events for which the transition rates will be computed. If omitted (default), transition rates are computed between the distinct states in seqdata (obtained with the alphabet function).

time.varying

Logical. If TRUE, return an array containing a distinct matrix for each time unit. The time is the third dimension (subscript).

weighted

Logical. If TRUE, compute transition rates using weights specified in seqdata.

lag

Integer. Time between the two states considered to compute transition rates (one by default).

with.missing

Logical. If FALSE (default value), returned transition rates ignore missing values.

Details

Transition rates are the probabilities of transition from one state to another observed in the sequence data. Substitution costs based on transition rates can be used when computing distances between sequences with the optimal matching method (see seqdist).

Value

a matrix of dimension ns*ns, where ns is the number of states in the alphabet of the sequence object.

Author(s)

Matthias Studer and Alexis Gabadinho (first version) (with Gilbert Ritschard for the help page)

References

Gabadinho, A., G. Ritschard, N. S. M<fc>ller and M. Studer (2011). Analyzing and Visualizing State Sequences in R with TraMineR. Journal of Statistical Software 40(4), 1-37.

See Also

seqdist seqsubm alphabet.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
  ## Loading the 'actcal' example data set
  data(actcal)

  ## Defining a sequence object with data in columns 13 to 24
  ## (activity status from january to december 2000)
  actcal.seq <- seqdef(actcal,13:24,informat='STS')

  ## Computing transition rates
  seqtrate(actcal.seq)

  ## Computing transition rates between states "A" and "B" only
  seqtrate(actcal.seq, c("A","B"))

## ====================
## Example with weights
## ====================
data(ex1)
ex1.seq <- seqdef(ex1,1:13, weights=ex1$weights)

seqtrate(ex1.seq, weighted=FALSE)
seqtrate(ex1.seq, weighted=TRUE)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.