Skip to main content
completed my answer with information about the PST package
Source Link
Gilbert
  • 2.1k
  • 11
  • 13

You are right, to compute "OM" dissimilarities with missing states you need substitution costs for replacing missing values. However, this is exactly what the TraMineR seqdist function expects.

The seqdist help page states: "If the OM method is selected, seqdist expects a substitution cost matrix with a row and a column entry for the missing state (symbol defined with the nr option of seqdef)."

An easy way to define such a matrix respecting the correct order of the alphabet augmented with the state state, is to first create such a matrix with for example

sm <- seqsubm(yourseq, method="CONSTANT", with.missing=TRUE)

and then replace the content of the matrix with your wanted costs before passing it to seqdist. You can also make use of the miss.cost argument to set a constant substitution cost for missing states.

As for the imputation of missing states, in addition to Brendan Halpin's nice multiple imputation solution, you could also consider exploiting the predictive capacities of Probabilistic suffix trees proposed in the just released Alexis Gabadinho's PST package.

Hope this helps.

You are right, to compute "OM" dissimilarities with missing states you need substitution costs for replacing missing values. However, this is exactly what the TraMineR seqdist function expects.

The seqdist help page states: "If the OM method is selected, seqdist expects a substitution cost matrix with a row and a column entry for the missing state (symbol defined with the nr option of seqdef)."

An easy way to define such a matrix respecting the correct order of the alphabet augmented with the state state, is to first create such a matrix with for example

sm <- seqsubm(yourseq, method="CONSTANT", with.missing=TRUE)

and then replace the content of the matrix with your wanted costs before passing it to seqdist. You can also make use of the miss.cost argument to set a constant substitution cost for missing states.

Hope this helps.

You are right, to compute "OM" dissimilarities with missing states you need substitution costs for replacing missing values. However, this is exactly what the TraMineR seqdist function expects.

The seqdist help page states: "If the OM method is selected, seqdist expects a substitution cost matrix with a row and a column entry for the missing state (symbol defined with the nr option of seqdef)."

An easy way to define such a matrix respecting the correct order of the alphabet augmented with the state state, is to first create such a matrix with for example

sm <- seqsubm(yourseq, method="CONSTANT", with.missing=TRUE)

and then replace the content of the matrix with your wanted costs before passing it to seqdist. You can also make use of the miss.cost argument to set a constant substitution cost for missing states.

As for the imputation of missing states, in addition to Brendan Halpin's nice multiple imputation solution, you could also consider exploiting the predictive capacities of Probabilistic suffix trees proposed in the just released Alexis Gabadinho's PST package.

Hope this helps.

Source Link
Gilbert
  • 2.1k
  • 11
  • 13

You are right, to compute "OM" dissimilarities with missing states you need substitution costs for replacing missing values. However, this is exactly what the TraMineR seqdist function expects.

The seqdist help page states: "If the OM method is selected, seqdist expects a substitution cost matrix with a row and a column entry for the missing state (symbol defined with the nr option of seqdef)."

An easy way to define such a matrix respecting the correct order of the alphabet augmented with the state state, is to first create such a matrix with for example

sm <- seqsubm(yourseq, method="CONSTANT", with.missing=TRUE)

and then replace the content of the matrix with your wanted costs before passing it to seqdist. You can also make use of the miss.cost argument to set a constant substitution cost for missing states.

Hope this helps.