Randomly generate a 4 X 4 stochastic matrix that satisfies Chargaff's second parity rule for dinucleotides.
rcspr2mat(labels=c("a", "c", "g", "t"))
a vector of labels for the rows and columns of the matrix. By default, this is set to the set of four nucleotides a, c, g and t.
A 4 X 4 stochastic matrix satisfying Chargaff's second parity rule. The rows and columns are labelled according to labels.
This function randomly generates Stochastic matrices of the form
$$ \left(\begin{array}{cccc} b_1&b_2&b_3&1-(b_1+b_2+b_3) \\ zb_6&b_4 & 1-(zb_6+b_4+zb_3) & zb_3 \\ zb_5 &1-(zb_5+b_4+zb_2) & b_4&zb_2 \\ 1-(b_5+b_6+b_1)&b_5&b_6&b_1 \end{array}\right) $$
where \(b_1\), …, \(b_6\) are values in the interval (0,1) and \(z\) is a positive number.
Such matrices characterize sequences of DNA that comply with Chargaff's second parity rule for dinucleotides. See the reference for further information.
Hart, A.G. and Mart<ed>nez, S. (2011) Statistical testing of Chargaff's second parity rule in bacterial genome sequences. Stoch. Models 27(2), 1--46.