It seems that PST
cannot predict the conditional probabilities of the next state after contexts which consist of a single state, e.g. EX-EX
Consider this code:
# Load libraries
library(RCurl)
library(TraMineR)
library(PST)
# Get data
x <- getURL("https://gist.githubusercontent.com/aronlindberg/08228977353bf6dc2edb3ec121f54a29/raw/c2539d06771317c5f4c8d3a2052a73fc485a09c6/challenge_level.csv")
data <- read.csv(text = x)
# Load and transform data
data <- read.table("thread_level.csv", sep = ",", header = F, stringsAsFactors = F)
# Create sequence object
data.seq <- seqdef(data[2:nrow(data),2:ncol(data)], missing = NA, right= NA, nr = "*")
# Make a tree
S1 <- pstree(data.seq, ymin = 0.05, L = 6, lik = TRUE, with.missing = TRUE)
# Mine the context
context <- seqdef("EX-EX")
p_context <- predict(S1.p1, context, decomp = F, output = "prob")
The line context <- seqdef("EX-EX")
yields:
[>] 1 distinct states appear in the data:
1 = EX
Error:
[!] alphabet contains only one state
which means that predict()
cannot be executed.
How do I predict the conditional probabilities of the next state based on contexts which only have 1 state, which may be repeated multiple times?