eigCA4Multinom: Sample from a multinomial distribution (with a given...

View source: R/fastInferences4-eigen-CA.R

eigCA4MultinomR Documentation

Sample from a multinomial distribution (with a given probability distribution) and compute the eigenvalues of a correpondence analysis of the simulated matrix..

Description

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.

Usage

eigCA4Multinom(nobs, prob, nrow, ncol)

Arguments

nobs

grand total of the table to be simulated.

prob

probability distribution for the cells. Should be length = nrow*ncol (see below for these parameters).

nrow

The number of rows of the matrix to be simulated.

ncol

The number of columns of the matrix to be simulated.

Details

eigCA4Multinom is mostly used for computing eigenvalues of created data matrices simulating permutation and bootstrap procedures for correspondence analysis.

Value

OUTPUT_DESCRIPTION

Author(s)

Hervé Abdi

Examples

## 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)

HerveAbdi/data4PCCAR documentation built on Sept. 11, 2022, 4:19 p.m.