gm.sim.ixj {gmvalid}R Documentation

Random (i x j)-way dependency tables with given marginals

Description

Generates random (i x j)-way dependency tables with given marginals.

Usage

gm.sim.ixj(N, pa, pb)

Arguments

N Number of observations; sample size.
pa Weight vector of length i to assign the distribution of the row totals.
pb Weight vector of length j to assign the distribution of the column totals.

Value

A (i x j)-matrix.

Note

Observed totals that were generated according to the shorter weight vector reflect the given weights only approximatively.

Author(s)

Ronja Foraita, Fabian Sobotka
Bremen Institute for Prevention Research and Social Medicine
(BIPS) http://www.bips.uni-bremen.de

See Also

gm.generate, gm.modelsim, r2dtable

Examples

    gm.sim.ixj(1000,c(1,1,1),c(1,1,1,1,1))
    gm.sim.ixj(1000,c(.2,.3,.4,.1),c(.5,.2,.3)) 
    
    round(gm.sim.ixj(30,c(1,1),c(1,1)))       
    
    tab <- round(gm.sim.ixj(500,c(.5,.5),c(.5,.5)))
    chisq.test(tab)   

[Package gmvalid version 1.0 Index]