Dear Edward,
Without knowing what you want exactly, it is basically impossible to help
you out.
The following code (with simulated data) works just fine. In what sense did
you not have success with HMM and/or depmixS4?
Best, Ingmar
library(HMM)
dat <- data.frame(Slide1_ACC=sample(c(0,1),100,rep=T))
hmm <- initHMM(c("stay", "switch"),
c("correct", "incorrect"), c(.5, .5),
matrix(c(.9, .1, .1, .9),2), matrix(c(.2, .8, .8, .2), 2))
dat$test <- ifelse(dat$Slide1_ACC == 0, "incorrect",
"correct")
viterbi(hmm, dat$test)
Best, Ingmar
On Wed, Jul 27, 2011 at 8:35 PM, Edward Patzelt <patze003@umn.edu> wrote:
> R Community -
>
> I am attempting to fit a model as described in Hampton, Bossaerts, and
> O'doherty (J. Neuroscience) 2006. They use a bayesian hidden markov
model
> to model the Reversal Learning data. I have tried using HMM and depmixS4
> with no success. My data is a Reversal Learning Task in which there are 3
> sets of patterns over 3 blocks. The participant receives incorrect or
> correct feedback. 20% of the time they receive false feedback (they are
> told incorrect when they were in fact correct). Once the person achieves
> the criterion of 9/10 correct responses the contigencies reverse. I am
> confused on how to set up my states, symbols, starting probabilities,
> transition probabilities, and emission probabilities in R. This is what I
> have so far.
>
> hmm <- initHMM(c("stay", "switch"),
c("correct", "incorrect"), c(.5, .5),
> matrix(c(.9, .1, .1, .9),2), matrix(c(.2, .8, .8, .2), 2))
>
> dat$test <- ifelse(dat$Slide1_ACC == 0, "incorrect",
"correct")
>
> viterbi(hmm, dat$test)
>
>
> The sequence of observations I run through the model is the feedback the
> participant receives. Any help would be greatly appreciated. I think what
> I want to do is run the model on each participant to generate the most
> probable path and then compare that to the actual path to see if they match
> up.
>
> Best,
>
>
>
> --
> Edward H. Patzelt
> Research Assistant – TRiCAM Lab
> University of Minnesota – Psychology/Psychiatry
> VA Medical Center
> Office: S355 Elliot Hall - Twin Cities Campus
> Phone: 612-626-0072 Email: patze003@umn.edu
>
> Please consider the environment before printing this email
> www.psych.umn.edu/research/tricam
>
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
[[alternative HTML version deleted]]