rhmm | R Documentation |
Simulates one or more replicates of discrete data
from a model such as is fitted by the function hmm()
.
rhmm(model,...,nsim,verbose=FALSE) ## Default S3 method: rhmm(model, ..., nsim=1, verbose=FALSE, ylengths, nafrac=NULL, fep=NULL, tpm, Rho, ispd=NULL, yval=NULL, drop=TRUE, forceNumeric=TRUE) ## S3 method for class 'hmm.discnp' rhmm(model, ..., nsim=1, verbose=FALSE, inMiss=TRUE, fep=NULL, drop=TRUE, forceNumeric=TRUE)
model |
An object of class |
... |
Not used. |
nsim |
Integer scalar; the number of data sets to be simulated. |
verbose |
Logical scalar. If |
ylengths |
Integer values vector specify the lengths (or number of rows in the bivariate setting) of the individual observation sequences constituting a data set. |
nafrac |
See |
fep |
“First entry present”. See |
tpm |
The transition probability matrix for the underlying hidden
Markov chain(s). Note that the rows of |
Rho |
An object specifying the probability distribution of the
observations, given the state of the underlying hidden Markov chain.
(I.e. the “emission” probabilities.) See |
ispd |
A vector specifying the initial state probability
distribution of the chain. If this is not specified it is taken
to be the stationary distribution of the chain, calculated from
|
yval |
Vector of possible values of the observations, or (in
the bivariate setting) a list of two such vectors. If not supplied
it is formed from the levels of the factor constituting the |
drop |
Logical scalar; if |
inMiss |
Logical scalar; if |
forceNumeric |
Logical scalar; if |
If nsim>1
or drop
is FALSE
then the value
returned is a list of length nsim
. Each entry of this
list is in turn a list of the same length as ylengths
,
each component of which is an independent vector or matrix of
simulated observations. The length or number of rows of component
i
of this list is equal to ylengths[i]
. The values
of the observations are entries of yval
or of its
entries when yval
is a list.
If nsim=1
and drop
is TRUE
then the (“outer”)
list described above is replaced by its first and only entry
If the length of ylengths
is 1
and drop
is
TRUE
then each “inner” list described above is
replaced by its first and only entry.
You may find it useful to avail yourself of the function
nafracCalc()
to determine the fraction of missing
values in a given existing (presumably “real”) data set.
Rolf Turner
r.turner@auckland.ac.nz
hmm()
nafracCalc()
misstify()
# To do: one or more bivariate examples. ## Not run: y <- list(linLandFlows$deciles,ftLiardFlows$deciles) fit <- hmm(y,K=3) simX <- rhmm(fit) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.