repairCyclicModel: Repairing a SEM model that is cyclic.

Description Usage Arguments Details Value Author(s) Examples

View source: R/repairCyclicModel.R

Description

Repairing a SEM model that is cyclic.

Usage

1
repairCyclicModel(stringModel = NULL, numVar = NULL, longitudinal = NULL)

Arguments

stringModel

binary vector with length n^2+(n(n-1)) if longitudinal = TRUE, or n(n-1) if FALSE, where n is the number of variables (numVar).

numVar

number of variables.

longitudinal

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

Details

The main idea of this function is to seek cyclic(s) with any possible length from a given model, and then to cut the cyclic, so as to make the model acyclic. Moreover, this function is used in stableSpec to ensure no cyclic model in the computation.

Value

a binary vector with the same length of input, representing a repaired model (acyclic).

Author(s)

Ridho Rahmadi r.rahmadi@cs.ru.nl

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
num_vars <- 6
longi_a <- FALSE
longi_b <- TRUE

# Assume that the generated model below is cyclic
# a cross-sectional model
model_a <- round(runif(num_vars * num_vars))
# a longitudinal model
model_b <- c(round(runif(num_vars * num_vars)),
round(runif(num_vars * (num_vars-1))))

repaired_model_a <- repairCyclicModel(stringModel=model_a, numVar=num_vars,
longitudinal=longi_a)

repaired_model_b <- repairCyclicModel(stringModel=model_b, numVar=num_vars,
longitudinal=longi_b)

repaired_model_a
repaired_model_b

rahmarid/stablespec documentation built on May 26, 2019, 9:51 p.m.