seqquality: Sequence Quality Index

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/seqquality.R

Description

Calculates a generalized version of the sequence quality index for a state sequence object. The original version of the index proposed by Manzoni & Mooi-Reci 2018 was defined for the binary case: states were either marked as failures or successes. Drawing on the work of Ritschard et al. 2018, the generalized version allows to specify a quality hierarchy assigning a (unique) quality score to each state.

Usage

1
seqquality(seqdata, stqual = NULL, weight = 1, time.varying = FALSE)

Arguments

seqdata

State sequence object (class stslist) created with the seqdef function.

stqual

Numeric vector defining a quality hierarchy of states. Length has to match length of the sequence alphabet. If not specified default equals order of elements in the aplphabet with higher-order states indicating higher quality.

weight

Number or numeric vector specifying weighting factor (see details). Default is 1.

time.varying

Default is FALSE.

Details

The generalized sequence index is a generalization of the index proposed by Manzoni & Mooi-Reci 2018. It is defined as

Q(x) = \frac{∑_{i=1}^{k}{q_{i}i^{w}_{i}}}{∑_{i=1}^{k}{q_{max}i^{w }_{i}}}

where i indicates the position within the sequence and k the total length of the sequence. w is a weighting factor simultaneously affecting how strong the index reacts to (and recovers from) a change in state quality. q_{i} is a weighting factor denoting the quality of a state at position i. The function normalizes the quality factor (stqual) to have values between 0 and 1. Therefore, q_{max}=1. If no quality vector is specified (stqual= NULL), the first state of the alphabet is coded 0, whereas the last state is coded 1. For the states in-between each step up the hierarchy increases the value of the vector by \frac{1}{(l(A)−1)}, with l(A) indicating the length of the alphabet. This procedure was borrowed from seqprecstart.

It is possible to assign the same quality score to multiple states to the alphabet. As a matter of fact, a stqual vector only comprising the values 0 and 1 is identical to the original (binary) version of the quality index proposed by Manzoni & Mooi-Reci 2018.

Value

Data frame (actually tibble) or list of data frames if time.varying = TRUE and multiple weights are specified.

Author(s)

Marcel Raab

References

Manzoni, A. and Mooi-Reci, I. (2018), "Measuring Sequence Quality", 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 261-278. Cham: Springer.

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.

See Also

Companion web page for our book on sequence analysis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Load TraMineR and use its 'actcal' example data set (first 200 rows)
# and define sequence object 'actcal.seq'
library(TraMineR)
data(actcal)
actcal <- actcal[1:200,] ## subset: first 200 rows
actcal.seq <- seqdef(actcal[,13:24])

# Quality index using original state order
# (does not make much sense here)
seqquality(actcal.seq)

# Quality index using an alternative quality hierarchy
seqquality(actcal.seq, stqual = 4:1)

# Quality index at every position of the sequence (time.varying = T)
# and with three different weights
seqquality(actcal.seq, stqual = c(4:1), weight = c(.5,1,2), time.varying = T)

maraab23/seqquality documentation built on Feb. 8, 2022, 12:54 a.m.