seqprecarity {TraMineRextras} | R Documentation |
The precarity index returned by the function seqprecarity
is a modified complexity index that takes account of the ordinal order (possibly only partial order) of the states and data-driven correction factors derived from the overall frequencies of the transitions occurring in the sequence. The transition-based weights of the sequences can be extracted per se by means of the function seqprecorr
. (See details.)
seqprecarity(seqdata, correction=NULL, otto=.2, a=1, b=1.2, state.order=alphabet(seqdata), state.equiv=NULL, ...) seqprecorr(seqdata, state.order=alphabet(seqdata), state.equiv=NULL, tr.type="TRATEDSS", weight.type="ADD", penalized="BOTH", with.missing=FALSE, norm=FALSE)
seqdata |
a state sequence object (class |
correction |
Vector of correction factor values. If |
otto |
Scalar in the range [0,1]. Trade-off weight between the precarity level of the initial state and the corrected complexity. Default is |
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. |
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 define the non-comparable states. |
state.equiv |
List of state equivalence classes. The classes in the list are each set as the vector of the short labels of the states forming the class. |
tr.type |
One of |
weight.type |
One of |
penalized |
One of |
with.missing |
Logical. Should the missing state be considered as an element of the alphabet? |
norm |
Logical. Should the weights be normalized by the maximal number of transitions. Not a true normalization because, depending on the transition weights, their sum in a sequence can exceed the number of transitions. |
... |
Arguments passed to |
The precarity index of a sequence x is based on the complexity index (Gabadinho et al., 2010) c(x) (See the seqici
function from TraMineR) and is defined as
prec(x) = lambda * a(x_1) + (1 - lambda)*(1 + q(x))^b*c(x)^a
where a(x_1) is the level of precarity of the starting state in sequence x, q(x) is the weighted proportion of negative transitions (or, with a negative sign, of the positive transitions) in the sequence. The lambda parameter (argument otto
) serves to trade-off the importance of the precarity of the starting state and the corrected complexity index. Parameters a and b (argument a
and b
) are exponent weights of respectively the complexity and the correction factor.
The weighted proportion of negative transitions q(x) can be obtained separately by means of the function seqprecorr
. The type of probabilities used to determine the transition weights can be controlled with tr.type
. Likewise, the way how theses probabilites are transformed into weights is controlled with weight.type
. The argument penalized
allows to chose between three strategies: only penalizing negative weights, only rewarding (with negative penalties) positive transitions, and applying both positive and negative penalties.
When equivalent classes are provided, the transitions between states of a same class are ignored and the class mean starting precarity level is assigned to each state of the class (see seqprecstart
).
As for non-comparable states (those not listed on the state.order
argument), the transition to or from such states is ignored and they all receive the mean level (.5) as starting precarity.
For seqprecarity
, a vector with the precarity index of each sequence. The returned vector has an attribute stprec
that contains the state precarity level used at the starting position.
For seqprecorr
, the vector of the weighted proportion q(x) with as additional attributes: tr
the used transition probabilities; signs
the transitions signs; state.noncomp
the non-comparable states; and state.order
the used state order.
Gilbert Ritschard
Ritschard, G., Bussi, M., and O'Reilly, J. (forthcoming), "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, Springer.
Gabadinho, A., Ritschard, G., Studer, M. and Müller, N.S. (2010), "Indice de complexité pour le tri et la comparaison de séquences catégorielles", In Extraction et gestion des connaissances (EGC 2010), Revue des nouvelles technologies de l'information RNTI. Vol. E-19, pp. 61-66.
seqici
and seqprecstart
.
## Defining a sequence object with columns 13 to 24 ## in the 'actcal' example data set data(actcal) actcal.seq <- seqdef(actcal[,13:24]) ## precarity using the original state order prec <- seqprecarity(actcal.seq) ici <- seqici(actcal.seq) ## complexity seqn <- seqformat(actcal.seq, to="SPS", compressed=TRUE) tab <- data.frame(seqn,ici,prec) names(tab) <- c("seq","ici","prec") head(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" head(tab)