Claus,
Given that you have observed the hidden states they are not really hidden
anymore ... so maybe an HMM is not what you are looking for.
Assuming that you had such super observation powers using something like:
by(obs,hid,table)
will get you the state dependent counts of the categories of y and using
something like:
table(hid[-100],hid[-1])
gives you the transition counts (assuming hid has length -100)
hth, Ingmar
On Mon, Dec 19, 2011 at 7:25 PM, Claus O'Rourke
<claus.orourke@gmail.com>wrote:
> Hi,
> I'm a newbie to the world of HMMs and HMMs in R. I've had a look at
> the hmm package and the RHmm package but I couldn't see anything
> straightforward on how a labelled sequential dataset with observed
> values and underlying states might be used to construct and train a
> HMM based on that data and no pre-computed values for the transition,
> emission or initial state distributions. Does anyone have any excerpts
> of code that could get me moving in the right direction?
>
> To put it another way, lets say that I have the simple HMM topology
> that is shown here:
> http://en.wikipedia.org/wiki/File:HiddenMarkovModel.png
> And I have somehow collected datasets with observations and labelled
> hidden states:
>
> Sequence 1:
> Obs Hid
> y1 X1
> y2 X2
> y2 X2
> y4 X1
> ... ...
> y3 X3
>
> ...
>
> Sequence N:
> Obs Hid
> y2 X1
> y2 X2
> y2 X1
> y4 X1
> ... ...
> y4 X1
>
> I'm assuming categorial variables for y and x.
>
> I know I really am starting from from scratch here, so I'd be very
> grateful if anyone could point out to me how I could go about
> automatically constructing and parameterizing a HMM for data like this.
>
> Thanks for your patience.
>
> Claus.
>
> ______________________________________________
> 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]]