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

seqprecarity

Precarity index


Description

The precarity index is essentially the complexity index corrected by the difference between the proportion of downward and upward transitions, and the undesirableness of the first state in the sequence.

Usage

seqprecarity(seqdata, correction=NULL,
    otto=.2, a=1, b=1.2, stprec=NULL, method = "TRATEDSS",
    state.order=alphabet(seqdata, with.missing), state.equiv=NULL, 
    with.missing=FALSE, ...)

seqprecorr(seqdata, state.order=alphabet(seqdata, with.missing), state.equiv=NULL,
    penalized="BOTH", method="TRATEDSS", weight.type="ADD",
    stprec=NULL, with.missing=FALSE, border.effect=10, tr.type)

Arguments

seqdata

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

correction

Vector of non-negative correction factor values. If NULL, the correction factors are set as 1 minus the value returned by seqprecorr.

otto

Scalar in the range [0,1]. Trade-off weight between the precarity degree of the initial state and the corrected complexity. Default is otto=.5 for seqprecarity (.2 for seqprecarity.old.

a

Non-negative real value. Exponent weight of the complexity. Default is 1.

b

Non-negative real value. Exponent weight of the correction factor. Default is 1.2.

stprec

Vector of state undesirableness degrees. If NULL the values are derived from the state order using seqprecstart. If not NULL, the values in stprec should conform the order of the alphabet. Use negative values to indicate non-comparable states. See details.

state.order

Vector of short state labels defining the order of the states. First the less precarious (most positive) state and then the other states in increasing precariousness order. States of the alphabet that are not included here (and are not equivalent to one of the listed state) define the non-comparable states.

state.equiv

List of state equivalence classes. Each class in the list is given as the vector of the short labels of the states forming the class.

method

One of 'FREQ', 'FREQ+', 'TRATE', 'TRATE+', 'TRATEDSS' (default for seqprecarity.old and seqprecorr), 'TRATEDSS+', 'RANK' (default for seqprecarity and seqidegrad), 'RANK+', or 'ONE'. Method for determining transition weights. Weights based on transition probabilities: 'FREQ' overall frequency of the transitions, 'TRATE' transition probabilities, and 'TRATEDSS' transition probabilites in the DSS sequences. 'RANK' differences between state precarity degrees. 'ONE' no weight. With the + form the returned penalty is adjusted by the mean transition weight in the sequence.

weight.type

One of 'ADD' (default), 'INV', or 'LOGINV'. When method is one of 'FREQ', 'TRATE' or 'TRATEDSS', how weights are derived from the transition probabilities: 'ADD' additive (1-p), 'INV' inverse (1/p), and 'LOGINV' log of inverse. Ignored when any other method is selected.

penalized

One of 'BOTH' (default), 'NEG', 'POS', or 'NO'. What should be penalized or rewarded? 'NEG' only negative transitions, POS only positive transitions (with negative penalization), 'BOTH' penalize negative transitions and reward positive ones, NO no penalization. Can also be logical with TRUE equivalent to 'BOTH' and FALSE equivalent to 'NO'.

with.missing

Logical. Should the missing state be considered as an element of the alphabet?

border.effect

Value (strictly greater than 1) used to adjust estimated transition probabilities to avoid border effect. Default is 10. See details.

tr.type

Deprecated. Use method instead.

...

Arguments passed to seqprecorr

Details

The seqprecorr function returns the penalizing factor q(x), i.e. the difference between the proportions of downward and upward transitions (state changes).

The argument penalized allows to chose between three strategies for computing q(x): only penalizing negative weights (in which case q(x) is the proportion of negative transitions), only rewarding (with negative penalties) positive transitions, and applying both positive and negative penalties. The transitions can be weighted and the type of transition weights used is selected with the method argument. For weights based on transition probabilities, the way how theses probabilites are transformed into weights is controlled with weight.type. To avoid a border effect, when any computed transition probability p is close from 1 (p > 1 - .1/d), all p's are adjusted as p - p/d, where d is the border.effect parameter. With method="RANK", the weights are set as the differences between the to and from state undesirableness.

The precarity index of a sequence x is based on the complexity index (Gabadinho et al., 2010) c(x) (See the seqici function), and the undesirableness a(x_1) of the starting state. It is defined as

prec(x) = lambda * a(x_1) + (1 - lambda)*r(x)^b*c(x)^a

where r(x) is the correction factor (argument correction) for the sequence. The lambda parameter (argument otto) determines the trade-off between the importance of the undesirableness of the starting state and of the corrected complexity index. Parameters a and b (argument a and b) are exponent weights of respectively the complexity and the correction factor.

When correction = NULL (default), r(x) is determined as r(x) = 1 + q(x), where the penalty q(x) is the degrading index. When correction = NULL and type=2, the correction is set as r(x) = (1 + q(x))/2.

When stprec is a vector, negative values indicate non-comparable sates that receive each the mean positive undesirableness value. After this transformation, the vector is normalized such that the minimum is 0 and the maximum 1.

When equivalent classes are provided, the class mean undesirableness degree is assigned to each state of the class (see seqprecstart). For the count of transitions a same state value is assigned to all equivalent states.

Non-comparable states (those not listed on the state.order argument and not equivalent to a listed state) all receive the mean undesirableness value. For the count of transitions, transitions from and to non-comparable states are ignored and replaced by a transition between the states that immediately precede and follow a spell in non-comparable states.

When there are missing states in the sequences, set with.missing = TRUE to treat the missing state as an additional state. In that case the missing state will be considered as non-comparable unless you include the nr attribute of seqdata in state.order or state.equiv. With with.missing = FALSE, transitions to and from the missing state will just be ignored and the undesirableness value of the first valid state will be used as starting undesirableness.

Value

For seqprecarity, an object of class seqprec with the value of the precarity index for each sequence. The returned object has an attribute stprec that contains the state precarity degree used at the starting position. The associated print method (print.seqprec) prints the state precarity values without the additional attribute.

For seqprecorr an object of class seqprecorr with the weighted proportions q(x) and as additional attributes: tr the used transition weights; signs the transitions signs; state.noncomp the non-comparable states; and state.order the used state order. The associated print method (print.seqprecorr) prints the outcome values without the additional attributes.

Author(s)

Gilbert Ritschard

References

Ritschard, G. (2020), "Measuring the nature of individual sequences", manuscript.

Ritschard, G., Bussi, M., and O'Reilly, J. (2018), "An index of precarity for measuring early employment insecurity", in G. Ritschard, and M. Studer, Sequence Analysis and Related Approaches: Innovative Methods and Applications, Series Life Course Research and Social Policies, Vol. 10, pp 279-295. Cham: Springer.

Gabadinho, A., Ritschard, G., Studer, M. and M\"uller, N.S. (2010), "Indice de complexit\'e pour le tri et la comparaison de s\'equences cat\'egorielles", In Extraction et gestion des connaissances (EGC 2010), Revue des nouvelles technologies de l'information RNTI. Vol. E-19, pp. 61-66.

See Also

Examples

## Defining a sequence object with columns 13 to 24
## in the 'actcal' example data set
data(actcal)
actcal <- actcal[1:20,] ## Here, only a subset
actcal.seq <- seqdef(actcal[,13:24], alphabet=c('A','B','C','D'))

## precarity using the original state order
prec <- seqprecarity(actcal.seq)
ici <- seqici(actcal.seq) ## complexity

seqn <- seqformat(actcal.seq, to="SPS", compress=TRUE)
tab <- data.frame(seqn,ici,prec)
names(tab) <- c("seq","ici","prec")
tab

## Assuming A and B as equivalent regarding precarity
prec2 <- seqprecarity(actcal.seq, state.equiv=list(c('A','B')))
tab <- cbind(tab,prec2)
names(tab)[ncol(tab)] <- "prec2"

## and letting C be non-comparable
prec3 <- seqprecarity(actcal.seq, state.order=c("A","B","D"),
  state.equiv=list(c('A','B')))
tab <- cbind(tab,prec3)
names(tab)[ncol(tab)] <- "prec3"


## Extracting the q(x) used for the correction factor (1-q(x))
q <- seqprecorr(actcal.seq, state.order=c("A","B","D"),
  state.equiv=list(c('A','B')))
## correction factor
corr.f <- (1 + q)
## number of non neutral correction factors
length(corr.f[corr.f != 1])

## Precarity with transition weights based on transition probabilities
prec.trdss <- seqprecarity(actcal.seq, method='TRATEDSS')

## Precarity in presence of missing values:
##  missing state treated as an additional state
data(ex1)
## by default right missings are dropped from the sequences
s.ex1 <- seqdef(ex1[,1:13])
seqprecarity(s.ex1, with.missing=TRUE)

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.