rcspr2mat: Random Stochastic Matrices Complying with Chargaff's Second...

Description Usage Arguments Details Value Note Author(s) References See Also


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.


This function randomly generates Stochastic matrices of the form

b1 b2 b3 1-(b1+b2+b3) zb6 b4 1-(zb6+b4+zb3) zb3 zb5 1-(zb5+b4+zb2) b4 zb2 1-(b5+b6+b1) b5 b6 b1

where b1, ..., b6 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.


A 4 X 4 stochastic matrix satisfying Chargaff's second parity rule. The rows and columns are labelled according to labels.


This function is only intended for obtaining samples of matrices complying with CSPR. It doe snot sample uniformly from the set of all such matrices and hence is not appropriate for simulation experiments requiring uniformly drawn samples.


Andrew Hart and Servet Mart<ed>nez


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.

See Also


Search within the spgs package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.