seqindic-dyn: Dynamic index

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

Description

Dynamic (i.e. successive) values of an individual index. For each sequence, the values of the selected index is computed on sliding windows.

Usage

1
2
seqindic.dyn(seqdata, indic="cplx", window.size = .2, sliding=TRUE,
      wstep=1, with.missing=FALSE, endmiss.as.void=FALSE, silent.indic=TRUE, ...)

Arguments

seqdata

state sequence object (stslist) as produced by seqdef

indic

character string: the individual index. Can be any value supported by seqindic except index group names.

window.size

integer or real. If an integer > 1, window size in number of positions. If real number in the range ]0,1), the window size is set as that proportion of the length of the longest sequence.

sliding

logical: Should indic be computed on sliding windows? If FALSE, windows are incremented starting with a window of size window.size.

wstep

integer: size of position gap between successive windows.

with.missing

logical. Should the missing state be treated as a state of the alphabet?

endmiss.as.void

logical. When with.missing=FALSE, should missings at end of windows be considered as voids, i.e. should the sequence end before end missings? When FALSE (default), the index is set as NA for windows that end with a void and, when TRUE, for windows that end with a void or a missing. Ignored when with.missing=TRUE.

silent.indic

logical. Should messages issued during computation of indic be suppressed?

...

additional arguments passed to seqindic

Details

The function implements the dynamic sequence analysis approach of Pelletier et al. (2020) and generalizes the method to any of the over 20 indicators provided by seqindic.

The values of the indic index are computed for each sequence either on sliding windows of size window.size or on incremental windows starting from a first window of size window.size.

Column names refer to the end the windows.

Value

A matrix of class dynin with attributes xtstep, tick.last, weights, window.size, sliding, and indic. The first three as well as the row and column names are taken from seqdata.

There are print and plot methods for dynin objects. See plot.dynin.

Author(s)

Gilbert Ritschard

References

Pelletier, D., Bignami-Van Assche, S., & Simard-Gendron, A. (2020) Measuring Life Course Complexity with Dynamic Sequence Analysis, Social Indicators Research doi: 10.1007/s11205-020-02464-y.

See Also

seqindic, plot.dynin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
data(actcal)
cases <- 1:100
actcal <- actcal[cases,] ## Here, only a subset
actcal.seq <- seqdef(actcal[,13:24], alphabet=c('A','B','C','D'))

## Using windows every three positions
a.dyn <- seqindic.dyn(actcal.seq, indic='cplx', with.missing=FALSE, wstep=3)
plot(a.dyn, group=actcal[cases,'sex'])

## Trimmed mean (to illustrate fstat with specific arguments) 
plot(a.dyn, group=actcal[cases,'sex'], fstat=function(x)mean(x, trim=.02))

## Incremental windows
ai.dyn <- seqindic.dyn(actcal.seq, indic='cplx', with.missing=FALSE, wstep=3, 
                sliding=FALSE)
plot(ai.dyn, group=actcal[cases,'sex'])

#############
## Sequences of different lengths, and with missing values and weights
data(ex1)
s.ex1 <- seqdef(ex1[,1:13],weights=ex1[,"weights"])
seqlength(s.ex1)
seqlength(s.ex1, with.missing=FALSE)
group <- c(1,1,1,2,2,2,2)

ind.d <- seqindic.dyn(s.ex1, indic='cplx', with.missing=FALSE)
plot(ind.d, group=group, fstat=weighted.mean, na.rm=TRUE, conf=TRUE, ret=TRUE)

## Treating 'missing' as a regular state
ind.dm <- seqindic.dyn(s.ex1, indic='cplx', with.missing=TRUE)
plot(ind.dm, group=group, fstat=weighted.mean, na.rm=TRUE, conf=TRUE, ret=TRUE)

TraMineRextras documentation built on June 25, 2021, 1:06 a.m.