Multichannel distance from a reference sequence I am working with a large dataset and applying multichannel sequence analysis to two life course domains. I would like to adapt a solution suggested in the post below to multichannel sequences, but I cannot find a way to adapt TraMineR seqdist() so that it works with multichannel sequences. I am looking for a way to calculate a multichannel distance from a reference sequence:
library(TraMineR)
data(biofam)
b.seq <- seqdef(biofam[, 10:25])

## compute pairwise distances on a random subset
spl <- sample(nrow(b.seq),400)
bs.seq <- b.seq[spl,]
d.lcs <- seqdist(bs.seq, method="LCS", full.matrix=FALSE)

## cluster the random subset
bs.hclust <- hclust(as.dist(d.lcs), method="ward.D")
#plot(bs.hclust, labels=FALSE)
cl <- cutree(bs.hclust,k=4)

## plot clusters for random subset
seqdplot(bs.seq, group=cl, border=NA)

## Medoids of the clusters
c.cl <- disscenter(d.lcs, group=cl, medoids="first")
seqiplot(bs.seq[c.cl,]) # plot of the medoids

## distances to each medoids
dc <- matrix(0,nrow=nrow(b.seq),ncol=length(c.cl))
for (i in 1:length(c.cl)) {
  dc[,i] <- seqdist(b.seq,method="LCS",refseq=spl[c.cl[i]])
}

## cluster membership for the full sequence dataset
##  is for each row the column with the smallest distance
cl.all <- max.col(-dc) 

## now we can plot clusters for the whole dataset
seqdplot(b.seq, group=cl.all, border=NA)

This example code is taken from this post.

Using function seqMD with argument what="MDseq" you get the multidomain/multichannel sequences, i.e., the sequences of the combined states of the different domains.
Once you have these multidomain sequences, you can compute any distance available with seqdist and, of course, use the refseqargument to compute distances to a reference sequence.
library(TraMineR)
data(biofam)

## Building one channel per type of event left home, married, and child
cases <- 200
bf <- as.matrix(biofam[1:cases, 10:25])
left <- bf==1 | bf==3 | bf==5 | bf==6
married <- bf == 2 | bf== 3 | bf==6
children <-  bf==4 | bf==5 | bf==6

## Building sequence objects
left.seq <- seqdef(left)
marr.seq <- seqdef(married)
child.seq <- seqdef(children)
channels <- list(LeftHome=left.seq, Marr=marr.seq, Child=child.seq)

## Building MD sequences
MD.seq <- seqMD(channels, what="MDseq")
## Distances from MD sequences to a reference sequence
MD.diss <- seqdist(MD.seq, method="HAM", refseq=MD.seq[1,])

