ranBin2 {binarySimCLF}R Documentation

Bivariate Binary Data

Description

Generates correlated binary vectors each of length 2. The routine is based on the pairwise odds ratio.

Usage

ranBin2(nRep, u, psi, seed)

Arguments

nRep Number of replications. One can think of nRep as the number of clusters with mean u and pairwise odds ratio psi.
u Mean vector of length 2
psi Odds ratio.
seed Sets the seed.

Value

Returns a response matrix of dimension nRep by 2. Each row represents an independent cluster.

See Also

mbsclf1, mbsclf, ranXch

Examples

    # Examples
    u = c(0.25, 0.25);
    psi = 1.75;

    # Begin: checking whether the odds pairwise odds ratio is compatible with the
    # mean vector u.
    v = psi2var(psi,u);  v
    cr = var2cor(v);  cr
    cp = chkBinC(cr,u); cp$compat
    # End: checking compatibility.

    y = ranBin2(1000,u,psi)
    r = cor(y);r
    ybar = apply(y,2,mean);ybar
    psihat = cor2psi(r,ybar)$psi;psihat

[Package binarySimCLF version 1.0 Index]