Learn R Programming

TraMineR (version 1.6-2)

seqsubsn: Number of distinct subsequences in a sequence.

Description

Computes the number of distinct subsequences in a sequence using Elzinga's algorithm.

Usage

seqsubsn(seqdata, DSS=TRUE)

Arguments

seqdata
a sequence object as defined by the seqdef function.
DSS
if TRUE, the Distinct State Sequences (DSS, see seqdss) are first extracted, eg. the DSS contained in 'D-D-D-D-A-A-A-A-A-A-A-D' is 'D-A-D', and the number of distinct subsequences in the DSS is computed. If

Value

  • a vector containing the number of distinct subsequences for each sequence in the input sequence object.

Details

The function searches for missing states in the sequences and if found, adds the missing state to the alphabet for the extraction of the distinct subsequences. A missing state in a sequence is considered as the occurence of an additional symbol of the alphabet, and two or more consecutive missing states are considered as two or more occurences of the same state. The with.missing=TRUE argument is used for calling the seqdss function when DSS=TRUE.

See Also

seqdss.

Examples

Run this code
data(actcal)
actcal.seq <- seqdef(actcal,13:24)

## Number of subsequences with DSS=TRUE 
seqsubsn(actcal.seq[1:10,])

## Number of subsequences with DSS=FALSE 
seqsubsn(actcal.seq[1:10,],DSS=FALSE)

Run the code above in your browser using DataLab