Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getExtraOutput

Get extra outputs from the result of simulation


Description

Get extra outputs from a simulation result object (SimResult). Users can ask this package to extra output from the lavaan object in each iteration by setting the outfun argument (in the sim function). See the example below.

Usage

getExtraOutput(object, improper = TRUE, nonconverged = FALSE)

Arguments

object

SimResult that have the extra output extracted by the function defined in the outfun argument (in the sim function)

improper

Specify whether to include the information from the replications with improper solutions

nonconverged

Specify whether to include the information from the nonconvergent replications

Value

A list of extra outputs

Author(s)

Sunthud Pornprasertmanit (psunthud@gmail.com)

See Also

  • sim A function to run a Monte Carlo simulation

Examples

## Not run: 
loading <- matrix(0, 6, 1)
loading[1:6, 1] <- NA
LY <- bind(loading, 0.7)
RPS <- binds(diag(1))
RTE <- binds(diag(6))
CFA.Model <- model(LY = LY, RPS = RPS, RTE = RTE, modelType="CFA")

# Write a function to extract the modification index from lavaan object
outfun <- function(out) {
	result <- inspect(out, "mi")
}

# We will use only 5 replications to save time.
# In reality, more replications are needed.
Output <- sim(5, n=200, model=CFA.Model, outfun=outfun)

# Get the modification index of each replication
getExtraOutput(Output)

## End(Not run)

simsem

SIMulated Structural Equation Modeling

v0.5-16
GPL (>= 2)
Authors
Sunthud Pornprasertmanit [aut], Patrick Miller [aut], Alexander Schoemann [aut] (<https://orcid.org/0000-0002-8479-8798>), Terrence D. Jorgensen [aut, cre] (<https://orcid.org/0000-0001-5111-6773>), Corbin Quick [ctb]
Initial release
2021-03-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.