| ranBin2 {binarySimCLF} | R Documentation |
Generates correlated binary vectors each of length 2. The routine is based on the pairwise odds ratio.
ranBin2(nRep, u, psi, seed)
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. |
Returns a response matrix of dimension nRep by 2. Each row represents
an independent cluster.
# 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