helske/seqHMM

EM algorithm failed

robertladwig opened this issue · 1 comments

Hi, I am having problems with a certain dataset which cannot be fitted a Markov model using fit_model() as I am always getting this error

EM algorithm failed: Backward probabilities contain non-finite values.

I am unsure what is causing this for that specific dataset as all others are working without problems.

Here's a reproducible example:

df = data.frame('event_1' = c(2,2,2,2,2),
                'event_2' = c(4,9,5,8,4),
                'event_3' = c(9,4,9,4,8),
                'event_4' = c(8,8,8,9,6),
                'event_5' = c(6,6,4,6,9),
                'event_6' = c(5,1,6,5,1),
                'event_7' = c(1,7,1,1,5),
                'event_8' = c(7,5,7,7,7),
                'event_9' = c(3,3,3,3,3))

pheno_seq <- seqdef(df, start = 1)

sc_initmod <- build_mm(observations = pheno_seq)

sc_fit <- fit_model(sc_initmod, em_step = TRUE, global_step = TRUE, local_step = TRUE, 
                    control_em = list(print_level = 2))

sc_fit$logLik

This results in

iter: 1 logLik: -38.901 relative change: 1
Warning messages:
1: In fit_model(sc_initmod, em_step = TRUE, global_step = TRUE, local_step = TRUE,  :
  EM algorithm failed: Backward probabilities contain non-finite values.
2: In fit_model(sc_initmod, em_step = TRUE, global_step = TRUE, local_step = TRUE,  :
  Global optimization terminated: NLOPT_FAILURE: Generic failure code.
3: In fit_model(sc_initmod, em_step = TRUE, global_step = TRUE, local_step = TRUE,  :
  Local optimization terminated: NLOPT_FAILURE: Generic failure code.

Thanks for any help!

I'll close this as a likely duplicate of #64 and continue there.