0

I would like to know if there is a way to get the AIC and BIC of the different orders of the markov chain derived by the command:

fitHigherOrder() from the markovchain package.

What I am looking for is something like:

maxOrder <- 5
result <- data.frame()
for (k in 1:maxOrder) {
  skip_to_next <- FALSE
  mc <- tryCatch(fitMarkovChain(clickstreamList = mydata, order = k), error = function(e) {skip_to_next <<- TRUE})
  if(skip_to_next){
    next 
  }else{
    result <- rbind(result, c(k, summary(mc)$aic, summary(mc)$bic))
  }
}

Use for clickstreams https://bookdown.org/gubiithefish/test/403-Clickstream-application.html

I have tried the same function with fitHigherOrder and fitHigherOrder()$aic but they didn't work.

Does it exist a command like assessOrder() that allows to choose the optimal order when orders are greater than two?

user20650
  • 24,654
  • 5
  • 56
  • 91
Ado
  • 1

0 Answers0