seqindic.dyn | R Documentation |
Dynamic (i.e. successive) values of an individual index. For each sequence, the values of the selected index is computed on sliding windows.
seqindic.dyn(seqdata, indic="cplx", window.size = .2, sliding=TRUE,
wstep=1, with.missing=FALSE, endmiss.as.void=FALSE, silent.indic=TRUE, ...)
seqdata |
state sequence object ( |
indic |
character string: the individual index. Can be any value supported by |
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 |
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 |
silent.indic |
logical. Should messages issued during computation of indic be suppressed? |
... |
additional arguments passed to |
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.
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
.
Gilbert Ritschard
Pelletier, D., Bignami-Van Assche, S., & Simard-Gendron, A. (2020) Measuring Life Course Complexity with Dynamic Sequence Analysis, Social Indicators Research \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11205-020-02464-y")}.
seqindic
, plot.dynin
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.