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 with the correlation structure between the two sets.

Finally, the general case is given a population correlation matrix, generate data that will reproduce (with sampling variability) that correlation matrix. `sim.correlation`

.

1 2 3 4 5 |

`fx` |
The measurement model for x |

`Phi` |
The structure matrix of the latent variables |

`fy` |
The measurement model for y |

`f` |
The measurement model |

`n` |
Number of cases to simulate. If n=0, the population matrix is returned. |

`uniq` |
The uniquenesses if creating a covariance matrix |

`raw` |
if raw=TRUE, raw data are returned as well for n > 0. |

`items` |
TRUE if simulating items, FALSE if simulating scales |

`low` |
Restrict the item difficulties to range from low to high |

`high` |
Restrict the item difficulties to range from low to high |

`d` |
A vector of item difficulties, if NULL will range uniformly from low to high |

`cat` |
Number of categories when creating binary (2) or polytomous items |

`mu` |
A vector of means, defaults to 0 |

`R` |
The correlation matrix to reproduce |

`data` |
if TRUE, return the raw data, otherwise return the sample correlation matrix. |

Given the measurement model, fx and the structure model Phi, the model is f %*% Phi %*% t(f). Reliability is f %*% t(f). *f φ f'* and the reliability for each test is the items communality or just the diag of the model.

If creating a correlation matrix, (uniq=NULL) then the diagonal is set to 1, otherwise the diagonal is diag(model) + uniq and the resulting structure is a covariance matrix.

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 congeneric 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.

`sim.correlation`

will create data sampled from a specified correlation matrix for a particular sample size. If desired, it will just return the sample correlation matrix. With data=TRUE, it will return the sample data as well.

`model ` |
The implied population correlation or covariance matrix |

`reliability ` |
The population reliability values |

`r` |
The sample correlation or covariance matrix |

`observed` |
If raw=TRUE, a sample data matrix |

William Revelle

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

`make.hierarchical`

for another structural model and `make.congeneric`

for the one factor case. `structure.list`

and `structure.list`

for making symbolic structures.

1 2 3 4 5 6 7 8 9 10 11 12 | ```
fx <-matrix(c( .9,.8,.6,rep(0,4),.6,.8,-.7),ncol=2)
fy <- matrix(c(.6,.5,.4),ncol=1)
rownames(fx) <- c("V","Q","A","nach","Anx")
rownames(fy)<- c("gpa","Pre","MA")
Phi <-matrix( c(1,0,.7,.0,1,.7,.7,.7,1),ncol=3)
gre.gpa <- sim.structural(fx,Phi,fy)
print(gre.gpa,2)
#correct for attenuation to see structure
round(correct.cor(gre.gpa$model,gre.gpa$reliability),2)
congeneric <- sim.structure(f=c(.9,.8,.7,.6)) # a congeneric model
congeneric
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.