Recodes sequence data into the shape used for qualitative harmonic analysis.

seq2qha(seqdata, periods)

Arguments

seqdata

a sequence object (see seqdef function).

periods

numeric vector of the first positions of the periods used for recoding

Value

A data frame with one column by combination of period and state (i.e. number of columns = number of periods * number of states in the alphabet).

References

Robette N., Thibault N. (2008). Comparing qualitative harmonic analysis and optimal matching. An exploratory study of occupational trajectories, Population-E, Vol. 64(3), 533-556. Deville J-C. (1982). Analyse de données chronologiques qualitatives: comment analyser des calendriers ?, Annales de l’INSEE, 45, 45-104. Deville J-C., Saporta G. (1980). Analyse harmonique qualitative, in Data analysis and informatics, E.Diday (ed.), Amsterdam, North Holland Publishing, 375-389.

Author

Nicolas Robette

Examples

data(trajact)
seqact <- seqdef(trajact)
#>  [>] 6 distinct states appear in the data: 
#>      1 = 1
#>      2 = 2
#>      3 = 3
#>      4 = 4
#>      5 = 5
#>      6 = 6
#>  [>] state coding:
#>        [alphabet]  [label]  [long label] 
#>      1  1           1        1
#>      2  2           2        2
#>      3  3           3        3
#>      4  4           4        4
#>      5  5           5        5
#>      6  6           6        6
#>  [>] 500 sequences in the data set
#>  [>] min/max sequence length: 37/37
qha <- seq2qha(seqact, periods=c(1,3,7,12,24))
head(qha)
#>   Per1St1 Per1St2 Per1St3 Per1St4 Per1St5 Per1St6 Per2St1 Per2St2 Per2St3
#> 1       0       1       0       0       0       0    0.00     1.0    0.00
#> 2       1       0       0       0       0       0    0.75     0.0    0.25
#> 3       1       0       0       0       0       0    0.50     0.5    0.00
#> 4       1       0       0       0       0       0    0.50     0.5    0.00
#> 5       1       0       0       0       0       0    1.00     0.0    0.00
#> 6       1       0       0       0       0       0    1.00     0.0    0.00
#>   Per2St4 Per2St5 Per2St6 Per3St1 Per3St2 Per3St3 Per3St4 Per3St5 Per3St6
#> 1       0       0       0       0     1.0       0       0     0.0     0.0
#> 2       0       0       0       0     0.0       1       0     0.0     0.0
#> 3       0       0       0       0     1.0       0       0     0.0     0.0
#> 4       0       0       0       0     0.8       0       0     0.0     0.2
#> 5       0       0       0       0     1.0       0       0     0.0     0.0
#> 6       0       0       0       0     0.8       0       0     0.2     0.0
#>   Per4St1 Per4St2 Per4St3 Per4St4 Per4St5 Per4St6 Per5St1 Per5St2 Per5St3
#> 1       0   1.000       0       0   0.000       0       0   1.000   0.000
#> 2       0   0.000       1       0   0.000       0       0   0.857   0.143
#> 3       0   0.333       0       0   0.667       0       0   0.000   0.429
#> 4       0   1.000       0       0   0.000       0       0   1.000   0.000
#> 5       0   1.000       0       0   0.000       0       0   1.000   0.000
#> 6       0   0.833       0       0   0.167       0       0   1.000   0.000
#>   Per5St4 Per5St5 Per5St6
#> 1       0   0.000       0
#> 2       0   0.000       0
#> 3       0   0.571       0
#> 4       0   0.000       0
#> 5       0   0.000       0
#> 6       0   0.000       0