Learn R Programming

TraMineR (version 1.1)

seqgen: Random sequences generation

Description

Generates random sequences.

Usage

seqgen(n, length, alphabet, p)

Arguments

n
number of sequences to generate
length
sequences length
alphabet
the alphabet from which the sequences are generated
p
an optional vector of probabilities for the states in the alphabet. Must be of the same length as the alphabet. If not specified, probabilities are equal.

Value

  • a sequence object.

Details

Each sequence is generated by choosing a set of random numbers (with min=1 and max=length of the alphabet) using the runif function. Since, at this time, the uniform probability distribution is used to generate the sequences, the frequency of occurence is equal for each state.

Examples

Run this code
seq <- seqgen(1000,10,1:4,c(0.2,0.1,0.3,0.4))
seqstatd(seqdef(seq))

Run the code above in your browser using DataLab