binary_cov_matrix: Covariance matrix for binary variables

View source: R/binary_multiESS.R

binary_cov_matrixR Documentation

Covariance matrix for binary variables

Description

Covariance matrix for binary variables

Usage

binary_cov_matrix(x, ncores = 2)

Arguments

x

a matrix or data.frame containing only binary variables.

ncores

(optional) number of cores to be used.

Value

covariance matrix.

Examples

N <- 100
M <- 1000
X <- matrix(rbinom(n = N*M, size = 1, p = .234), ncol = N, nrow = M)
covmat.binary <- binary_cov_matrix(X)
covmat.default <- var(X)
plot(covmat.binary ~ covmat.default)
abline(a = 0, b = 1, lty = 2)

maxbiostat/BinaryMarkovChains documentation built on Dec. 11, 2023, 4:29 a.m.