repairCyclicModel {stablespec} | R Documentation |
Repairing a SEM model that is cyclic.
Description
Repairing a SEM model that is cyclic.
Usage
repairCyclicModel(stringModel = NULL, numVar = NULL, longitudinal = NULL)
Arguments
stringModel |
binary vector with length
|
numVar |
number of variables. |
longitudinal |
|
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
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
[Package stablespec version 0.3.0 Index]