seqtransn | R Documentation |
Computes the number of transitions (state changes) in each sequence of a sequence object.
seqtransn(seqdata, with.missing=FALSE, norm=FALSE, pweight=FALSE)
seqdata |
a state sequence object as defined by the
|
with.missing |
logical: should non-void missing values be treated as a regular state? If |
norm |
logical. If set as |
pweight |
logical. EXPERIMENTAL! If set as |
A transition in a sequence is a state change between
time/position t
and t+1
. For example, the sequence
"A-A-A-A-B-B-A-D-D-D"
contains 3 transitions. The maximum
number of transitions a sequence can contain is \ell-1
where \ell
is the length of the sequence. The number of
transitions is obtained by subtracting 1 to the length of the sequence
of distinct successive states (DSS).
a one column matrix with the number of transitions in each sequence.
Alexis Gabadinho (with Gilbert Ritschard for the help page)
Gabadinho, A., G. Ritschard, N. S. Müller and M. Studer (2011). Analyzing and Visualizing State Sequences in R with TraMineR. Journal of Statistical Software 40(4), 1-37.
seqdss
.
## Creating a sequence object from columns 13 to 24
## in the 'actcal' example data set
data(actcal)
actcal.seq <- seqdef(actcal,13:24)
## Computing the number of transitions
actcal.trans <- seqtransn(actcal.seq)
## Displaying number of transitions in the first 10 sequences
actcal.trans[1:10]
## Example with with.missing argument
data(ex1)
ex1.seq <- seqdef(ex1, 1:13)
seqtransn(ex1.seq)
seqtransn(ex1.seq, with.missing=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.