modelPop: Random SEM models.

Description Usage Arguments Details Value Author(s) Examples

Description

Generating recursive (acyclic) SEM models represented by binary vectors.

Usage

1
2
modelPop(nPop = NULL, numVar = NULL, longitudinal = NULL,
  consMatrix = NULL)

Arguments

nPop

number of models to generate or population size.

numVar

number of variables.

longitudinal

TRUE for longitudinal data, and FALSE for cross-sectional data.

consMatrix

m by 2 binary matrix representing constraint/prior knowledge, where m is the number of constraint. For example, known that variables 2 and 3 do not cause variable 1, then constraint <- matrix(c(2, 1, 3, 1), 2, 2, byrow=TRUE)) will be the constraint matrix.

Details

This function generates nPop random SEM models which are represented by binary vectors; 1 means there is a causal path from, e.g., variable A to B and 0 otherwise. In addition, the generated models have passed the cyclic test to ensure they are all acyclic. The function also includes minPop models which representing models from each model complexity, i.e., minPop = numVar(numVar-1)/2+1, if longitudinal = FALSE, or minPop = (numVar(numVar-1)/2+1)+numVar^2, otherwise. If nPop <= minPop then this function will generate minPop models.

Value

nPop or minPop by m matrix, where m is the length of the binary vector depending of the given number of variables and also whether longitudinal or cross-sectional model.

Author(s)

Ridho Rahmadi r.rahmadi@cs.ru.nl

Examples

1
2
3
4
#assumming a prior knowledge that variable 1 does not cause variable 2
models <- modelPop(nPop=25, numVar=6,
longitudinal=FALSE, consMatrix = matrix(c(1, 2), 1, 2))
models

stablespec documentation built on May 2, 2019, 10:14 a.m.