-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsimulate.mm.Rd
47 lines (41 loc) · 1.29 KB
/
simulate.mm.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mm.R
\name{simulate.mm}
\alias{simulate.mm}
\title{Simulates k-th order Markov chains}
\usage{
\method{simulate}{mm}(object, nsim = 1, seed = NULL, ...)
}
\arguments{
\item{object}{An object of class \link{mm}.}
\item{nsim}{An integer or vector of integers (for multiple sequences)
specifying the length of the sequence(s).}
\item{seed}{Optional. \code{seed} for the random number generator.
If no \code{seed} is given, then seed is set by using the command
\verb{set.seed(round(as.numeric(Sys.time()))}.}
\item{...}{further arguments passed to or from other methods.}
}
\value{
A list of vectors representing the sequences.
}
\description{
Simulates k-th order Markov chains.
}
\details{
If \code{nsim} is a single integer then a chain of that length is
produced. If \code{nsim} is a vector of integers, then \code{length(nsim)}
sequences are generated with respective lengths.
}
\examples{
states <- c("a", "c", "g", "t")
s <- length(states)
k <- 2
init <- rep.int(1 / s ^ k, s ^ k)
p <- matrix(0.25, nrow = s ^ k, ncol = s)
# Specify a Markov model of order 1
markov <- mm(states = states, init = init, ptrans = p, k = k)
seqs <- simulate(object = markov, nsim = c(1000, 10000, 2000), seed = 150)
}
\seealso{
\link{mm}, \link{fitmm}
}