getModelFitness: Scoring the given SEM models.

Description Usage Arguments Value Author(s) Examples

Description

Compute the model chi-square and model complexity of the given SEM models.

Usage

1
2
getModelFitness(theData = NULL, allModelString = NULL, numTime = NULL,
  longitudinal = NULL, co = NULL, mixture = NULL)

Arguments

theData

a data frame containing the data to which the model is to be fit. If parameter longitudinal is TRUE, the data frame should be reshaped such that the first n data points contain the relations that occur in the first two time slices t_0 and t_1. The next n data points contain the relations that occur in time slices t_1 and t_2. The i-th subset of n data points contain the relations in time slices t_i-1 and t_i. One can use function dataReshape to reshape longitudinal data.

allModelString

m by n matrix of binary vectors representing models, where m is the number of models, and n is the length of the binary vector.

numTime

number of time slices. If the data is cross-sectional, this argument must be set to 1.

longitudinal

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

co

whether to use "covariance" or "correlation" matrix.

mixture

if the data contains both continuous and categorical (or ordinal) variables, this argument can be set to TRUE. This implies the use of polychoric and polyserial correlation in the SEM computation. Note that, the categorical variables should be represented as factor or logical.

Value

a matrix of models including their fitness': chi-square and model complexity.

Author(s)

Ridho Rahmadi r.rahmadi@cs.ru.nl

Examples

1
2
3
4
5
6
7
8
the_data <- crossdata6V
#assummed that variable 5 does not cause variables 1, 2, and 3
models <- modelPop(nPop=5, numVar=6, longitudinal=FALSE,
consMatrix = matrix(c(5, 1, 5, 2, 5, 3), 3, 2, byrow=TRUE))

model_fitness <- getModelFitness(theData=the_data,
allModelString=models, numTime=1, longitudinal=FALSE,
co="covariance", mixture = FALSE)

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