gm.generate {gmvalid}R Documentation

Random data frames of binary variables with given marginals

Description

Generates a random data frame of independent binary variables with given marginals.

Usage

gm.generate(N, p = c(0.5, 0.5, 0.5))

Arguments

N Number of observations, sample size.
p Probability vector. Each element assigns the probability to draw a "2". The user-defined number of elements determines the number of variables in the resulting data frame.

Value

A data frame with number of rows equal to N and number of columns equal to the length of p.

Author(s)

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

See Also

gm.modelsim, gm.sim.ixj, r2dtable

Examples

gm.generate(10,c(.5,.2,.2))
gm.generate(15,c(.5,.5,.5,.5,.5,.5))

[Package gmvalid version 1.0 Index]