Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

seqipos

Indicators for binary sequences of positive and negative states.


Description

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.

Usage

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

Arguments

seqdata

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

dss

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

pos.states

vector of positive states.

neg.states

vector of negative states.

index

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

pow

real. Exponent passed to seqintegration. Only used when index="integration". Default is 1.

w

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

with.missing

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

Details

The function transforms the provided state sequences into binary sequence of positive and negative states. When dss = TRUE, the count 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 DSS sequence will have two consecutive occurrences of the spell. 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.

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

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

Value

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

Author(s)

Gilbert Ritschard

References

Brzinsky-Fay, C. (2007) Lost in Transition? Labour Market Entry Sequences of School Leavers in Europe, European Sociological Review, 23(4). 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.

See Also

Examples

data(ex1)
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="integration")

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

TraMineR

Trajectory Miner: a Toolbox for Exploring and Rendering Sequences

v2.2-1
GPL (>= 2)
Authors
Alexis Gabadinho [aut, cph], Matthias Studer [aut, cph] (<https://orcid.org/0000-0002-6269-1412>), Nicolas M"{u}ller [aut], Reto B"{u}rgin [aut], Pierre-Alexandre Fonta [aut], Gilbert Ritschard [aut, cre, cph] (<https://orcid.org/0000-0001-7776-0903>)
Initial release
2020-10-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.