2

Is there any R package that supports fitting an HMM using multiple sequences of observations? to the best of my knowledge depmixS4 does not support this feature

1 Answers1

1

No, depmixS4 supports multiple external variables to be included to forecast underlying time series. In this case transition matrix is a function of all the other external variables. It is given in depmix S4 vignette also.-

a useful material for start - https://machinelearningstories.blogspot.com/2017/02/hidden-markov-model-session-1.html &
http://machinelearningstories.blogspot.in/2017_03_01_archive.html

R Code snippets-

Required library

library(depmixS4)

data loading-

physician_prescrition_data <-c(12,16,45,45,56,67,78,98,120,124,156)

model execution-

HMM_model <- depmixS4::depmix(physician_prescrition_data~1, nstates = 2,ntimes=length(physician_prescrition_data))

model fitting

HMM_fm <- fit(HMM_model)

Transition probabilties-

HMM_fm@transition

posterior states-

posterior(HMM_fm) plot(ts(posterior(HMM_fm)[,1]))

Emission probabilties-

HMM_fm@response

Arpit Sisodia
  • 415
  • 2
  • 10
  • In model execution, instead of ' physician_prescrition_data~1' , one has to write physician_prescrition_data ~ all external variable. – Arpit Sisodia Aug 13 '18 at 05:54