Learn R Programming

psych (version 1.0-61)

sim.structural: Create correlation matrices or data matrices with a particular measurement and structural model

Description

Structural Equation Models decompose correlation or correlation matrices into a measurement (factor) model and a structural (regression) model. sim.structural creates data sets with known measurement and structural properties. Population or sample correlation matrices with known properties are generated. Optionally raw data are produced.

It is also possible to specify a measurement model for a set of x variables separately from a set of y variables. They are then combined into one model.

Usage

make.structural(s = NULL, f = NULL, n = 0, raw = FALSE)
sim.structural(s = NULL, f = NULL, n = 0,mx= NULL, my=NULL, raw = FALSE)

Arguments

s
A correlation (structure) matrix of latent variables.
f
The measurement model
mx
The measurement model for the x variables
my
The measurement model for the y variables
n
Number of cases to simulate. If n=0, the population matrix is returned.
raw
if raw=TRUE, raw data are returned.

Value

  • modelThe correlation matrix
  • reliabilityThe population reliability values
  • dataIf raw=TRUE, a sample data matrix

Details

Given the measurement model, f and the structure model f, the model is f Given the model, raw data are generated using the mvnorm function.

A special case of a structural model are one factor models such as parallel tests, tau equivalent tests, and congneneric tests. These may be created by letting the structure matrix = 1 and then defining a vector of factor loadings. Alternatively, make.congeneric will do the same.

If all parameters are NULL, a default example is produced.

References

Revelle, W. (in preparation) An Introduction to Psychometric Theory with applications in R. Springer. at http://personality-project.org/r/book/

See Also

make.hierarchical for another structural model and make.congeneric for the one factor case.

Examples

Run this code
gre.gpa <- sim.structural()
print(gre.gpa,2)  #the raw correlation matrix
round(correct.cor(gre.gpa$model,gre.gpa$reliability),2)  #correct for attenuation to see structure
congeneric <- sim.structural(1,c(.9,.8,.7,.6)) # a congeneric model 
congeneric

Run the code above in your browser using DataLab