Description Usage Arguments Details Value Author(s) See Also Examples

Returns the probabilities that the underlying hidden state is equal to each of the possible state values, at each time point, given the observation sequence. Also can return the fitted conditional means, if requested, given that the observations are numeric.

1 2 |

`y` |
The observations on the basis of which the probabilities
of the underlying hidden states are to be calculated. May be
a (one or two column) matrix of observations, or a list each
component of which is such a matrix. If |

`model` |
An object of class |

`tpm` |
The transition probability matrix for the underlying hidden
Markov chain. Ignored if |

`Rho` |
An object specifying the distribution of the observations, given
the underlying state. I.e. the “emission” probabilities.
See |

`ispd` |
Vector specifying the initial state probability distribution
of the underlying hidden Markov chain.
Ignored if |

`X` |
An optional |

`addIntercept` |
Logical scalar. See the documentation of |

`means` |
A logical scalar; if |

`warn` |
Logical scalar; should a warning be issued if |

The conditional mean value at time *t* is calculated
as

*SUM_k gamma_t(k)*mu_k*

where *gamma_t(k)* is the conditional
probability (given the observations) that the hidden Markov
chain is in state *k* at time *t*, and *mu_k*
is the expected value of an observation given that the chain
is in state *k*.

If `means`

is `TRUE`

then the returned value is
a list with components

`probs` |
The conditional probabilities of the states at each time point. |

`means` |
The conditional expectations of the observations at each time point. |

Clearly this makes sense only if the observations are numeric.

Otherwise the returned value consists of `probs`

as
described above.

If there is a single matrix of observations `y`

then
`probs`

is a matrix whose rows correspond to the states
of the hidden Markov chain, and whose columns correspond to
the observation times. If the observations consist of a
list of observation vectors, then `probs`

is a list
of such matrices, one for each matrix of observations.

Likewise for the `means`

component of the list returned
when the argument `means`

is `TRUE`

.

Rolf Turner
[email protected]

`hmm()`

, `mps()`

,
`viterbi()`

, `pr()`

,
`fitted.hmm.discnp()`

1 2 3 4 5 6 7 8 9 10 11 | ```
P <- matrix(c(0.7,0.3,0.1,0.9),2,2,byrow=TRUE)
R <- matrix(c(0.5,0,0.1,0.1,0.3,
0.1,0.1,0,0.3,0.5),5,2)
set.seed(42)
y.num <- rhmm(ylengths=rep(300,20),nsim=1,tpm=P,Rho=R,drop=TRUE)
fit.num <- hmm(y.num,K=2,verb=TRUE,keep.y=TRUE,itmax=10)
cpe1 <- sp(model=fit.num,means=TRUE) # Using the estimated parameters.
cpe2 <- sp(y.num,tpm=P,Rho=R,means=TRUE,
warn=FALSE) # Using the ``true'' parameters.
# The foregoing would issue a warning that Rho had no row names
# were it not for the fact that "warn" has been set to FALSE.
``` |

hmm.discnp documentation built on Nov. 12, 2018, 1:04 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.