2
$\begingroup$

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

$\endgroup$
1
$\begingroup$

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

| improve this answer | |
$\endgroup$
  • $\begingroup$ In model execution, instead of ' physician_prescrition_data~1' , one has to write physician_prescrition_data ~ all external variable. $\endgroup$ – Arpit Sisodia Aug 13 '18 at 5:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.