Description Usage Arguments Details Value Note Author(s) See Also Examples
Generates nseq
random sequences of items represented by codes, either by random sampling (order 0), either using a Discrete Time Markov Chain (DTMC) transition matrix (order 1).
1 |
nseq |
numeric: number of sequences to generate. |
lmin |
numeric: minimum length of sequences |
lmax |
numeric: maximum length of sequences |
order |
numeric: order of the Markov Process, 0 or 1. See details. |
dico |
character vector: dictionnary of items. |
mattrans |
data.frame: transition matrix with identifiers as first column. |
Generates random sequences of states according to a Markov process of order 0 or 1.
order 0: the following state is drawn with equal probabilities in the item list, no influence of previous state.
order 1: the following state is drawn with a probability proportional to the product of the transition matrix by the vector of states.
nseq
sequences of random size are generated. The size of each sequence is a random integer drawn under uniform probability between lmin
and lmax
(both included).
A list of nseq items
A1 |
list: first sequence |
A2 |
list: second sequence |
... and so on until nseq
.
The transition matrix must be square and Markovian. A non-square matrix produces an error and program break. Its columns must all sum to 1. No verification is done for this last point. A matrix in which the columns do not sum to 1 may lead to spurious or unpredictible results.
Jean-Sebastien Pierre
Jean-sebastien.pierre@univ-rennes1.fr
1 2 3 4 5 6 7 8 | # 1 - generates 5 random sequences of length from 1 to 15 with
# symbols a,b,c,d.(order = 0)
geneseq(5,1,15,dico=letters[1:4])
mat<-data.frame(id=letters[1:3],a=c(0,0.75,0.25),b=c(0.5,0.25,0.25),
c=c(0.1,0.8,0.1))
# 2 - generates 2 random sequences of length 10 with symbols a,b,c,d
# according to the transition matrix mat
geneseq(2,10,10,order=1,mattrans=mat)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.