Here is my code:
library(RCurl)
library(TraMineR)
library(PST)
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)
data.seq <- seqdef(data[2:nrow(data),2:ncol(data)], missing = "NA", right = "*")
# Make a tree
S1 <- pstree(data.seq, ymin = 0.05, L = 6, lik = TRUE, with.missing = F)
logLik(S1)
For some reason, it refuses to return a Log-likelihood value? Why is this the case? How can I get a Log-likelihood value?
You have bad values for the
missingandrightarguments in yourseqdefcommand which then causes an error inpstree.With
we get
Note that since you have missing values I have set
with.missing = TRUEin thepstreecommand.===============
To ignore the right missings, set
right='DEL'inseqdef.I don't know what PST computes as
logLik(S2)and why we get here anNA. The likelihood to generate the data with the treeS2can be obtained by means of thepredictfunction that returns the likelihood of each sequence in the data. The log likelihood of the data should then bewhich gives