Learn R Programming

simsem (version 0.2-8)

simResult: Create simResult.

Description

This function will create simResult by different ways. One way is to create data and analyze data multiple times by specifying SimData and SimModel and save it in the SimResult.

Usage

simResult(nRep = NULL, objData = NULL, objModel = NULL, 
	objMissing = new("NullSimMissing"), seed = 123321, silent = FALSE, 
	multicore = FALSE, cluster = FALSE, numProc = NULL, n = NULL, 
	pmMCAR = NULL, pmMAR = NULL, objSet = NULL, 
	objFunction = new("NullSimFunction"))

Arguments

nRep
Number of replications. Users can specify as NULL and specify n, pmMCAR, and pmMAR as a vector instead. By this, the number of replications will be calculated from the length of n, pmM
objData
Data object used in data simulation.
objModel
Model object used in analyzing the simulated data.
objMissing
Model object used in providing the information about missing values.
seed
Seed number. This package will use this seed number to generate the L'Ecuyer (1999) method to make nonoverlapping seed values across replications from the nextRNGStream function.
silent
TRUE if users do not wish to print number of replications during running the function.
multicore
Use multiple processors within a computer. Specify as TRUE to use it.
cluster
Not applicable now. Use for specify nodes in hpc in order to be parallelizable.
numProc
Number of processors for using multiple processors. If it is NULL, the package will find the maximum number of processors.
n
Sample size. This argument is not necessary except the user wish to vary sample size across replications. The sample size here can be random distribution object (VirtualDist), or a vector of sample size in integers.
pmMCAR
The percent completely missing at random. This argument is not necessary except the user wish to vary percent missing completely at random across replications. The pmMCAR here can be random distribution object (VirtualDist<
pmMAR
The percent missing at random. This argument is not necessary except the user wish to vary percent missing at random across replications. The pmMAR here can be random distribution object (VirtualDist),
objSet
The SimSet object for data generation and analysis model. Users can specify this argument directly and not specify objData and objModel
objFunction
The function object that will be used for data transformation inside the simulation study. See the example from simFunction

Value

  • SimResult that saves analysis result from simulate data.

References

L'Ecuyer, P. (1999) Good parameters and implementations for combined multiple recursive random number generators. Operations Research, 47, 159-164.

See Also

  • SimDatafor data model specification
  • SimModelfor analysis model specification
  • SimResultfor the type of resulting object

Examples

Run this code
loading <- matrix(0, 6, 1)
loading[1:6, 1] <- NA
LX <- simMatrix(loading, 0.7)
RPH <- symMatrix(diag(1))
RTD <- symMatrix(diag(6))
CFA.Model <- simSetCFA(LY = LX, RPS = RPH, RTE = RTD)
SimData <- simData(CFA.Model, 500)
SimModel <- simModel(CFA.Model)
# We make the examples running only 5 replications to save time.
# In reality, more replications are needed.
Output <- simResult(5, SimData, SimModel)
summary(Output)

# Specify Sample Size by n
loading <- matrix(0, 6, 1)
loading[1:6, 1] <- NA
LX <- simMatrix(loading, 0.7)
RPH <- symMatrix(diag(1))
RTD <- symMatrix(diag(6))
CFA.Model <- simSetCFA(LY = LX, RPS = RPH, RTE = RTD)
SimData <- simData(CFA.Model, 500)
SimModel <- simModel(CFA.Model)
# We make the examples running only 5 replications to save time.
# In reality, more replications are needed.
Output <- simResult(NULL, SimData, SimModel, n=seq(50, 100, 10))
summary(Output)

# Specify both sample size and percent missing completely at random
Output <- simResult(NULL, SimData, SimModel, n=seq(50, 100, 10), pmMCAR=c(0, 0.1, 0.2))
summary(Output)

# Use distribution object on sample size and percent completely at random
n <- simUnif(100, 500)
pmMCAR <- simUnif(0, 0.1)
Output <- simResult(5, SimData, SimModel, n=n, pmMCAR=pmMCAR)

Run the code above in your browser using DataLab