Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

seqivardur

Variance of spell durations in individual sequences


Description

Variance of spell durations of individual state sequences.

Usage

seqivardur(seqdata, type=1, with.missing=FALSE)

## S3 method for class 'seqivardur'
print(x, stat='var', ...)

Arguments

seqdata

a state sequence object (stslist) as returned by seqdef.

type

either 1 or 2. The default type=1 ignores non visited states. Type 2 accounts for the 0-time spent in non-visited states (see Details).

with.missing

logical: should non-void missing values be treated as a regular state? If FALSE (default) missing values are ignored.

x

an outcome of seqivardur.

stat

string or vector of strings. Duration statistic to be printed. Either 'mean' (mean duration), 'std' (standard deviation), 'var' (variance), 'vmax' (maximum variance for number of spells), or 'all'. Default is 'var'.

...

further arguments such as digits passed to the next print method.

Details

The returned variance is a population variance, i.e. the sum of squares divided by the number of terms.

When type=1, this is the variance of the observed spells in the sequence. When type=2, in addition to the observed spells one spell of length 0 is considered for each non-visited state. The mean duration is computed conformably.

Value

A numeric vector with the spell duration variance of each sequence.

The returned object has two attributes:

vmax

the maximum value that the variance of each sequence could reach given its number of spells.

meand

the mean spell duration of each sequence.

Author(s)

Gilbert Ritschard

References

Ritschard, Gilbert (2020) Measuring the nature of state sequences, University of Geneva, preprint.

See Also

Examples

sq.dat <- c('AAAA','AAAC','ABC','ABAA','AC')
sq <- seqdef(seqdecomp(sq.dat, sep=''), right=NA)

seqivardur(sq, type=1)
seqivardur(sq, type=1, with.missing=TRUE)
vd2 <- seqivardur(sq, type=2)
print(vd2, stat='all')
vd2m <- seqivardur(sq, type=2, with.missing=TRUE)
print(vd2m, stat=c('var','vmax'))

TraMineR

Trajectory Miner: a Toolbox for Exploring and Rendering Sequences

v2.2-1
GPL (>= 2)
Authors
Alexis Gabadinho [aut, cph], Matthias Studer [aut, cph] (<https://orcid.org/0000-0002-6269-1412>), Nicolas M"{u}ller [aut], Reto B"{u}rgin [aut], Pierre-Alexandre Fonta [aut], Gilbert Ritschard [aut, cre, cph] (<https://orcid.org/0000-0001-7776-0903>)
Initial release
2020-10-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.