Learn R Programming

stablespec (version 0.1.3)

getModelFitness: Scoring the given SEM models.

Description

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

Usage

getModelFitness(theData = NULL, allModelString = NULL, numTime = NULL, longitudinal = NULL, co = 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.
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 a cross-sectional data then the it is 1.
longitudinal
TRUE for longitudinal data, and FALSE for cross-sectional data.
co
whether to use "covariance" or "correlation" matrix.

Value

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

Examples

Run this code

the_data <- adhd
models <- modelPop(nPop=25, numVar=6, longitudinal=FALSE,
consMatrix = matrix(c(1, 2), 1, 2))

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

Run the code above in your browser using DataLab