Learn R Programming

simsem (version 0.2-8)

SimData-class: Class "SimData"

Description

This class will save information for data simulation and can create data by run function.

Arguments

Objects from the Class

Objects can be created by simData. Also, it can be called by new("SimData", ...).

See Also

  • linkS4class{SimSet}for how to specify data generation model.
  • linkS4class{SimMisspec}for how to specify misspecification in this data generation model.
  • linkS4class{SimEqualCon}for how to set equality constraints for data generation.
  • link{simResult}for the use of this class to run Monte Carlo simulation.
  • linkS4class{SimModelOut}for the output type after therunfunction withdataOnly=TRUE.

Examples

Run this code
showClass("SimData")
loading <- matrix(0, 6, 2)
loading[1:3, 1] <- NA
loading[4:6, 2] <- NA
loadingValues <- matrix(0, 6, 2)
loadingValues[1:3, 1] <- 0.7
loadingValues[4:6, 2] <- 0.7
LX <- simMatrix(loading, loadingValues)
latent.cor <- matrix(NA, 2, 2)
diag(latent.cor) <- 1
RPH <- symMatrix(latent.cor, 0.5)
error.cor <- matrix(0, 6, 6)
diag(error.cor) <- 1
RTD <- symMatrix(error.cor)
CFA.Model <- simSetCFA(LY = LX, RPS = RPH, RTE = RTD)
SimData <- simData(CFA.Model, 200)
summary(SimData)
run(SimData)

Run the code above in your browser using DataLab