View source: R/fastInferences4-eigen-CA.R
eigCA4Multinom | R Documentation |
eigCA4Multinom
:
Sample from a multinomial distribution
(with a given probability distribution)
and compute the eigenvalues
of the CA of an nrow*ncol
(see below for these parameters).
data matrix simulating correspondence analysis.
eigCA4Multinom(nobs, prob, nrow, ncol)
nobs |
grand total of the table to be simulated. |
prob |
probability distribution
for the cells. Should be length = |
nrow |
The number of rows of the matrix to be simulated. |
ncol |
The number of columns of the matrix to be simulated. |
eigCA4Multinom
is mostly used for computing eigenvalues
of
created data matrices
simulating permutation and bootstrap procedures
for correspondence analysis.
OUTPUT_DESCRIPTION
Hervé Abdi
## Not run:
set.seed(87) # set the seed
X <- matrix(round(runif(21)*20), ncol = 3) # good for CA
nobs <- sum(X) # grand total
nI <- nrow(X)
nJ <- ncol(X)
pI <- as.matrix(rowSums(X) / nobs) # marginal I & J
pJ <- as.matrix(colSums(X) / nobs) # probabilites
p4Permutation <- pI %*% t(pJ) # Independence <=> permutation
# Simulated Permutation Probabilities
permEigen <- eigCA4Multinom(nobs, p4Permutation, nI, nJ)
p4Bootstrap <- X / nobs # Actual prob <=> Bootstrap
permBoots <- eigCA4Multinom(nobs, p4Bootstrap, nI, nJ)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.