| gm.modelsim {gmvalid} | R Documentation |
Generates a random data frame of discrete variables with a given dependence model and marginals.
gm.modelsim(N, model, categories = 0)
N |
Number of observations, sample size. |
model |
A character string assigning a dependence model expressed as clique structure. Each variable has to be expressed as a letter, e.g. "ABC,CDE". |
categories |
a list of weight vectors that assigns the weight of each catogory.
Number of list elements must equal the number of variables in model.
Default is "list(c(.5,.5),c(.5,.5),...)".
|
A data frame with number of rows approximately equal to N and number of columns equal
to the number of variables used in model.
Observed marginal probabilities reflect the given marginal probabilites only approximatively. Works best with population sizes over N=10,000.
Ronja Foraita, Fabian Sobotka
Bremen Institute for Prevention Research and Social Medicine
(BIPS) http://www.bips.uni-bremen.de
gm.generate, gm.sim.ixj, r2dtable
gm.modelsim(100,"AB,AC")
table( gm.modelsim(100,"a,b,c") )
tmp.df <- gm.modelsim(10000,"abf,cd,cf,bdeg,bfg")
# with given number of categories
tmp.df <- gm.modelsim(1000,"AB,C",list(c(1,1,1),c(1,1),c(1,1,1)))
# with given number of categories and marginals
tmp.df <- gm.modelsim(1000,"ABC",list(c(0.3,0.3,0.4),c(0.6,.4),c(0.25,0.25,0.5)))
table(tmp.df)
## Not run:
tmp.df <- gm.modelsim(100,"ABC",list(3,2,3))# (number of categories will be 2 x 2 x 2 )
gm.modelsim(100,"123")
## End(Not run)