seqprecarity | R Documentation |
The degradation index returned by seqidegrad
is a normalized transformation of the difference between the proportion of downward and upward state changes (transitions).
The precarity and insecurity indexes are composite measures of complexity, degradation tendency, and undesirableness of the first state in the sequence.
seqidegrad(seqdata, state.order=alphabet(seqdata, with.missing), state.equiv=NULL,
stprec=NULL, with.missing=FALSE,
penalized="BOTH", method="RANK", weight.type="ADD",
pow=1, border.effect=10)
seqprecarity(seqdata, correction=NULL,
state.order=alphabet(seqdata, with.missing), state.equiv=NULL,
stprec=NULL, with.missing=FALSE,
otto=.2, a=1, b=1.2, method = "TRATEDSS",
...)
seqinsecurity(seqdata, correction=NULL,
state.order=alphabet(seqdata, with.missing), state.equiv=NULL,
stprec=NULL, with.missing=FALSE,
pow = 1, spow=pow, bound=FALSE, method = "RANK",
...)
seqprecorr(...)
seqdata |
a state sequence object (class |
correction |
Vector of non-negative correction factor values. If |
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. |
stprec |
Vector of state undesirableness degrees. If |
with.missing |
Logical. Should the missing state be considered as an element of the alphabet? |
otto |
Scalar in the range [0,1]. Trade-off weight between the precarity degree 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. |
penalized |
One of |
method |
One of |
weight.type |
One of |
pow |
Real or logical. Recency weight exponent for potential to integrate the next spell. If real, transition weights are adjusted by the potential to integrate the next state using the |
spow |
Real. Recency weight exponent for potential to integrate the first spell. |
bound |
Logical. Should the insecurity index be bounded by undesirableness degrees of best and worst states in the sequence? |
border.effect |
Real. Value (strictly greater than 1) used to adjust estimated transition probabilities to avoid border effect. Default is 10. See details. |
... |
Arguments passed to |
The seqidegrad
function returns for each sequence x
the difference q(x)
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.
When pow
is not FALSE
, the weight of each transition is multiplied by the potential to integrate the next spell using the provided pow
value.
The precarity and insecurity indexes of a sequence x
are both based on the complexity index (Gabadinho et al., 2010) c(x)
(See the seqici
function) and the undesirableness degree \pi(x_1)
of the starting state.
The precarity applies a multiplicative correction to the complexity. It is defined as
prec(x) = \lambda \pi(x_1) + (1-\lambda)(1 + r(x))^\beta c(x)^\alpha
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 \alpha
and \beta
(arguments a
and b
) are exponent weights of respectively the complexity and the correction factor.
The insecurity index applies an additive correction of the complexity:
insec(x) = \pi(x_1) integr(x,sp1) + r(x) + c(x)
where integr(x,sp1)
is the potential to integrate the first spell (proportion of sequence length covered by first spell when spow=0
).
When correction = NULL
(default), r(x)
is set as the degradation index q(x)
provided by seqidegrad
. The degradation is computed with pow=FALSE
for the precarity and using the provided pow
value for the insecurity.
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.
The earlier seqprecorr
function is obsolete, use seqidegrad
with pow=FALSE
and method='TRATEDSS'
instead.
For seqprecarity
and seqinsecurity
, an object of class seqprec
with the value of the precarity or insecurity 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 seqidegrad
an object of class seqidegrad
with the degradation index 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.seqidegrad
) prints the outcome values without the additional attributes.
Gilbert Ritschard
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")}.
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, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/978-3-319-95420-2_16")}.
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
, seqibad
, seqprecstart
, seqindic
.
## 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'))
## insecurity and precarity using the original state order
insec <- seqinsecurity(actcal.seq)
prec <- seqprecarity(actcal.seq)
ici <- seqici(actcal.seq) ## complexity
seqn <- seqformat(actcal.seq, to="SPS", compress=TRUE)
tab <- data.frame(seqn,ici,insec,prec)
names(tab) <- c("seq","ici","insec","prec")
tab
## Assuming A and B as equivalent regarding insecurity
insec2 <- seqinsecurity(actcal.seq, state.equiv=list(c('A','B')))
tab <- cbind(tab,insec2)
names(tab)[ncol(tab)] <- "insec2"
## and letting C be non-comparable
insec3 <- seqinsecurity(actcal.seq, state.order=c("A","B","D"),
state.equiv=list(c('A','B')))
tab <- cbind(tab,insec3)
names(tab)[ncol(tab)] <- "insec3"
## bounding insecurity with undesirableness of best and worst state in sequence
insec4 <- seqinsecurity(actcal.seq, state.order=c("A","B","D"),
state.equiv=list(c('A','B')), bound=TRUE)
tab <- cbind(tab,insec4)
names(tab)[ncol(tab)] <- "insec4"
## degrading index
degr <- seqidegrad(actcal.seq, state.order=c("A","B","D"),
state.equiv=list(c('A','B')))
tab <- cbind(tab,degr)
names(tab)[ncol(tab)] <- "degr"
tab
## Precarity with transition weights based on differences in state undesirableness
prec.rank <- seqprecarity(actcal.seq, method='RANK')
###############
## Indexes 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])
state.order=c("A","B","C","D") ## missing left as non-comparable
seqprecarity(s.ex1, state.order=state.order, with.missing=TRUE)
seqinsecurity(s.ex1, state.order=state.order, with.missing=TRUE)
## same result using the correction argument
dgp <- seqidegrad(s.ex1, with.missing=TRUE, state.order=state.order, method='TRATEDSS')
seqprecarity(s.ex1, state.order=state.order, with.missing=TRUE, correction=dgp)
dg <- seqidegrad(s.ex1, with.missing=TRUE, state.order=state.order)
seqinsecurity(s.ex1, state.order=state.order, with.missing=TRUE, correction=dg)
## bounding insecurity with undesirableness of best and worst state in sequence
seqinsecurity(s.ex1, state.order=state.order, with.missing=TRUE, bound=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.