seqipos: Indicators for binary sequences of positive and negative...

View source: R/seqipos.R

seqiposR Documentation

Indicators for binary sequences of positive and negative states.


Indicators for the underlying binary sequences of positive and negative states. Possible indicators are the proportion of positive states within each sequence, i.e. of positive spells if computed on the sequences of distinct successive states (DSS), objective volatility of the binary sequences, and capacity to integrate a positive state.


  seqipos(seqdata, dss=NULL, pos.states=NULL, neg.states=NULL, index="share",
     pow=1, w=.5, with.missing=FALSE)



a state sequence object (stslist) as returned by seqdef.


logical. Should the proportion be computed inside the DSS sequences? Defaults to TRUE when index="share" and to FALSE otherwise.


vector of positive states.


vector of negative states.


character string. One of "share" (proportion of positive states or spells), "volatility" (objective volatility), or "integr" (capability to integrate a positive state). See Details. Default is "share".


real. Recency exponent passed to seqintegr. Only used when index="integr". Default is 1.


real in range [0,1]. Relative weight of proportion of visited states in volatility (see seqivolatility). Only used when index="volatility". Default is .5.


logical: should non-void missing values be treated as a regular state? If FALSE (default) missing values are ignored.


The function transforms the provided state sequences into binary sequences of positive and negative states. When dss = TRUE, the counts of positive and negative elements give the number of positive and negative spells. The binary state sequence object is returned as an attribute.

When neg.states=NULL, states not listed on the pos.states argument are considered as negative and conversely when pos.states=NULL. When with.missing=TRUE, the missing state nr will be considered as positive if included in the pos.states list or as negative if in neg.states. When with.missing=FALSE (default) missing states are ignored. However, when missing values appear within a spell, such as in AA*ABB, the spell is split into two consecutive spells in a same state. For the example we would have AAB, i.e. if A is positive and B negative, a proportion of 2/3 of positive spells.

When both pos.states and neg.states are provided, states of the alphabet (including the nr code when with.missing=TRUE) that belong nor to pos.states nor to neg.states are ignored.

For index="share", letting npos be the number of positive states and nneg the number of negative states in the sequence, the function returns the value of npos/(npos + nneg) for each sequence. With dss=TRUE, this is the normative volatility of Brzinsky-Fay (2007,2018).

For index="volatility", the function returns the objective volatility of the binary sequences. See seqivolatility.

For index="integr", the function returns the index of integrative potential for the positive state. See seqintegr.


A numeric vector of
- when index="share", the proportion of positive states (or spells) within each sequence;
- when index="volatility", the objective volatility of the binary sequences;
- when index="integration", the index of integration into a positive state.
The binary sequence as an attribute sbinary.


Gilbert Ritschard


Brzinsky-Fay, C. (2007) Lost in Transition? Labour Market Entry Sequences of School Leavers in Europe, European Sociological Review, 23(4). \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/esr/jcm011")}

Brzinsky-Fay, C. (2018) Unused Resources: Sequence and Trajectory Indicators. International Symposium on Sequence Analysis and Related Methods, Monte Verita, TI, Switzerland, October 10-12, 2018.

Ritschard, G. (2023), "Measuring the nature of individual sequences", Sociological Methods and Research, 52(4), 2016-2049. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1177/00491241211036156")}.

See Also

seqindic, seqintegr, seqivolatility


sx <- seqdef(ex1[,1:13], right="DEL")
nr <- attr(sx,'nr') ## code for missing values

seqipos(sx, pos.states=c("A","B"))
seqipos(sx, pos.states=c("A","B"), with.missing=TRUE)

## ignoring state "D"
seqipos(sx, pos.states=c("A","B"), neg.states=c("C",nr), with.missing=TRUE)

seqipos(sx, pos.states=c("A","B"), dss=FALSE)
seqipos(sx, pos.states=c("A","B",nr), dss=FALSE, with.missing=TRUE)

seqipos(sx, pos.states=c("A","B"), index="volatility")
seqipos(sx, pos.states=c("A","B"), index="integr")

## retrieving the binary sequences
ip <- seqipos(sx, pos.states=c("A","B"))
ip <- seqipos(sx, pos.states=c("A","B"), with.missing=TRUE)

TraMineR documentation built on May 29, 2024, 5 a.m.