hmm(y, yval=NULL, par0=NULL, K=NULL, rand.start=NULL, stationary=TRUE,
mixture=FALSE, tolerance=1e-4, verbose=FALSE, itmax=200,
crit='PCLL',keep.y=TRUE, data.name=NULL)
y
. If any value of y
does not match
some value of yval
, it will be treated as a MISSING VALUE.tpm
(transition probability
matrix) and Rho
. The matrix Rho
specifies the
probability that the observations take par0
is
not specified K
MUST be; if par0
is specified, K
is ignored.Note that K=1
is acceptable; if K
is 1 then all
observa
tpm
and Rho
, if tpm
is TRUE then the function
init.all() chooses entries for then starting value of tpm
at
random; likewise for Rho
TRUE
then the model is fitted under
the stationarity assumption, i.e. that the Markov chain was in
steady state at the time that observations commenced. In this
case the initial state probability distribution is itmax
EM steps have been performed, a warning message is printed out,
and the function stops. A value is returned by the function
anyway, with the logical component "converged" set toy
be returned as a component of the value of this function?y
as determined by deparse(substitute(y))
.Rho
specifying the
distributions of the observations.tpm
.stationary
is TRUE
then this is assumed to be the
(unique) stationary distribution for the chain, and thereby determined
by the transition probability matrix tpm
. If stationary
is FALSE
then ispd
is estimated as the mean of the
vectors of conditional probabilities of the states, given the
observation sequences, at time t=1
.y
). Present only if
keep.y
is TRUE
.stationary
y
to be
a matrix in the case of multiple observed series. If
the series were of unequal length the user was expected to pad
them out with NAs to equalize the lengths. In the revision
from version 0.0-9 to 0.1-0 this was changed, requiring the
argument y
to be (more sensibly) a list when there are
multiple series. Unfortunately this help page was not
correspondingly revised and the old ``matrix'' format was left
as being the specified input format.The old matrix format is still permitted (and the matrix is
internally changed into a list) but this is deprecated. In
some future version of hmm.discnp
this possibility
will be removed.
If K=1
then tpm
, ispd
, converged
, and
nstep
are all set equal to NA
in the list returned
by this function.
The estimate of ispd
in the non-stationary setting
is inevitably very poor, unless the number of sequences of
observations (the length of the list y
) is very large.
We have in effect ``less than one'' relevant observation for
each such sequence.
At some time in the future the (deprecated) option of being
able to specify argument y
as a matrix (in the setting
in which there are multiple data series to which a single
model is being fitted) will no longer be permitted.
Zucchini, W. and Guttorp, P., "A hidden Markov model for space-time precipitation," Water Resources Research vol. 27, pp. 1917-1923, 1991.
MacDonald, I. L., and Zucchini, W., "Hidden Markov and Other Models for Discrete-valued Time Series", Chapman & Hall, London, 1997.
Liu, Limin, "Hidden Markov Models for Precipitation in a Region of Atlantic Canada", Master's Report, University of New Brunswick, 1997.
sim.hmm()
, mps()
,
viterbi()
# See the help for sim.hmm() for how to generate y.num.
fit.num <- hmm(y.num,K=2,verb=TRUE)
fit.num.mix <- hmm(y.num,K=2,verb=TRUE,mixture=TRUE)
print(fit.num[c("tpm","Rho")])
# Note that states 1 and 2 get swapped.
Run the code above in your browser using DataLab