Learn R Programming

⚠️There's a newer version (0.5-17) of this package.Take me there.

simsem (version 0.2-0)

SIMulated Structural Equation Modeling.

Description

This package can be used to generate data using the structural equation modeling framework. This package is tailored to use those simulated data for various purposes, such as model fit evaluation, power analysis, or missing data handling and planning.

Copy Link

Version

Install

install.packages('simsem')

Monthly Downloads

1,283

Version

0.2-0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Sunthud Pornprasertmanit

Last Published

May 18th, 2012

Functions in simsem (0.2-0)

blankParameters

Change all elements in the non-null objects to be all NAs.
findFactorResidualVar

Find factor residual variances from regression coefficient matrix, factor (residual) correlations, and total factor variances
checkInputValue

Check the value argument in the matrix, symmetric matrix, or vector objects
isCorMatrix

Check whether a matrix is a possible correlation matrix
freeVector

Create a free parameters vector with a starting values in a vector object
runRep

Run one replication within a big simulation study
simChisq

Create random chi-squared distribution object
simMisspecPath

Set of model misspecification for Path analysis model.
simResultParam

The constructor of the parameter result object
simVector

Create simVector that save free parameters and starting values, as well as fixed values
simPois

Create random Poisson distribution object
symMatrix

Create symmetric simMatrix that save free parameters and starting values, as well as fixed values
skew

Finding skewness
summaryParam

Provide summary of parameter estimates and standard error across replications
writeLavaanIndividualConstraint

Write a lavaan code for a given equality constraint for each parameter
weightedMean

Calculate the weighted mean of a variable
SimData-class

Class "SimData"
SimGenLabels-class

Class "SimGenLabels"
SimVector-class

Vector object: Random parameters vector
SimModelMIOut-class

Class "SimModelMIOut"
adjust

Change an element in SimMatrix, SymMatrix, or SimVector.
extract

Extract a part of an object
createFreeParameters

Create a free parameters object from a model specification
isMeanConstraint

Check whether all rownames in a constraint matrix containing symbols of means vectors
imposeMissing

Impose MAR, MCAR, planned missingness, or attrition on a data set
miPool

Function to pool imputed results
runLavaan

Run data by the model object by the lavaan package
simResult

Create simResult.
startingValues

Find starting values by averaging random numbers
tagHeaders

Tag names to each element
writeLavaanNullCode

Write a lavaan code for a null model
vectorizeObject

Change an object to a vector with labels
summaryShort

Provide short summary of an object.
Nullclass

Null Objects
SimREqualCon-class

Class "SimREqualCon"
constrainMatrices

Impose an equality constraint in an object
expandMatrices

Expand the set of intercept and covariance matrices into the set of intercept/mean and covariance/correlation/variance objects
getPower

Find power in rejecting alternative models based on fit indices criteria
isDefault

Check whether a vector object is default
matchKeywords

Search for the keywords and check whether the specified text match one in the name vector
popMisfitMACS

Find population misfit by sufficient statistics
reduceConstraint

Reduce the model constraint to data generation parameterization to analysis model parameterization.
simBeta

Create random beta distribution object
simMissing

Construct a SimMissing object to create data with missingness and analyze missing data.
simFunction

Create function object
standardize

Standardize the parameter estimates within an object
simParamSEM

Create a set of matrices of parameters for analyzing data that belongs to SEM model
simData

Data object
validatePath

Validate whether the regression coefficient (or loading) matrix is good
SimFunction-class

Class "SimFunction"
collapseExo

Collapse all exogenous variables and put all in endogenous side only.
countFreeParameters

Count how many free parameters in the target object
createData

Create data from model parameters
fillParam

Fill in other objects based on the parameter values of current objects
kStat

Calculate the k-statistic of a variable
isVarianceConstraint

Check whether all rownames in a constraint matrix containing symbols of variance vectors
makeLabels

Make parameter names for each element in matrices or vectors or the name for the whole object
indProd

Make a product of indicators using mean centering or double-mean centering
plotMisfit

Plot the population misfit in parameter result object
findRecursiveSet

Group variables regarding the position in mediation chain
plotQtile

Build a scatterplot with overlaying line of quantiles of predicted values
run

Run a particular object in simsem package.
residualCovariate

Residual centered all target indicators by covariates
simLnorm

Create random log normal distribution object
simLogis

Create random logistic distribution object
simMisspecCFA

Set of model misspecification for CFA model.
simModel

Create simModel from model specification and be ready for data analysis.
simMisspecSEM

Set of model misspecification for SEM model.
simGeom

Create random geometric distribution object
simSetCFA

Create a set of matrices of parameter and parameter values to generate and analyze data that belongs to CFA model.
SimResult-class

Class "SimResult"
combineLatentCorExoEndo

Combine exogenous factor correlation and endogenous factor correlation into a single matrix
combineMeasurementErrorExoEndo

Combine measurement error correlation from the exogenous and endogenous sides into a single matrix
miPoolChi

Function to pool chi-square statistics from the result from multiple imputation
runMI

Multiply impute and analyze data using lavaan
getKeywords

List of all keywords used in the simsem package
loadingFromAlpha

Find standardized factor loading from coefficient alpha
simBinom

Create random binomial distribution object
simSetSEM

Create a set of matrices of parameter and parameter values to generate and analyze data that belongs to SEM model
toFunction

Export the distribution object to a function command in text that can be evaluated directly.
simT

Create random t distribution object
simParamPath

Create a set of matrices of parameters for analyzing data that belongs to Path analysis model
SimEqualCon-class

Class "SimEqualCon"
SimDataOut-class

Class "SimDataOut"
SymMatrix-class

Symmetric matrix object: Random parameters symmetric matrix
SimResultParam-class

Class "SimResultParam"
combinePathExoEndo

Combine the regression coefficient matrices
drawParametersMisspec

Create parameter sets (with or without model misspecification) from the parameter with or without misspecification set
drawParameters

Create parameter sets (with or without model misspecification) from the data object
findFactorIntercept

Find factor intercept from regression coefficient matrix and factor total means
SimMisspec-class

Class "SimMisspec"
extractOpenMxFit

Extract the fit indices reported by the OpenMx result
findIndIntercept

Find indicator intercepts from factor loading matrix, total factor mean, and indicator mean.
findIndMean

Find indicator total means from factor loading matrix, total factor mean, and indicator intercept.
findPossibleFactorCor

Find the appropriate position for freely estimated correlation (or covariance) given a regression coefficient matrix
isNullObject

Check whether the object is the NULL type of that class
findIndResidualVar

Find indicator residual variances from factor loading matrix, total factor covariance, and total indicator variances.
getPopulation

Extract the data generation population model underlying an object
miPoolVector

Function to pool imputed results that saved in a matrix format
popDiscrepancy

Find the discrepancy value between two means and covariance matrices
reassignNames

Reassign the name of equality constraint
reduceMatrices

Reduce the model constraint to data generation parameterization to analysis model parameterization.
simHyper

Create random hypergeometric distribution object
validateCovariance

Validate whether all elements provides a good covariance matrix
simUnif

Create random uniform distribution object
SimSet-class

Class "SimSet"
centralMoment

Calculate central moments of a variable
combineLoadingExoEndo

Combine factor loading from the exogenous and endogenous sides into a single matrix
ParameterSet

Class "VirtualRSet", "SimLabels" and "SimRSet"
cov2corMod

Convert a covariance matrix to a correlation matrix
findFactorMean

Find factor total means from regression coefficient matrix and factor intercept
extractVectorNames

Extract a vector of parameter names based on specified elements
extractLavaanFit

Extract fit indices from the lavaan object
findFactorTotalCov

Find factor total covariance from regression coefficient matrix, factor residual covariance
findIndTotalVar

Find indicator total variances from factor loading matrix, total factor covariance, and indicator residual variances.
pValue

Find p-values (1 - percentile)
popMisfit

Calculate population misfit
printIfNotNull

Provide basic summary of each object if that object is not NULL.
simCauchy

Create random Cauchy distribution object
writeLavaanCode

Write a lavaan code given the matrices of free parameter
simDataDist

Create a data distribution object.
simParamCFA

Create a set of matrices of parameters for analyzing data that belongs to CFA model.
writeLavaanConstraint

Write a lavaan code for a given set of equality constraints
SimDataDist-class

Class "SimDataDist"
SimMatrix-class

Matrix object: Random parameters matrix
SimParam-class

Class "SimParam"
anova

Provide a comparison of nested models across replications
SimModelOut-class

Class "SimModelOut"
VirtualDist-class

Distribution Objects
createImpliedMACS

Create model implied mean vector and covariance matrix
extractMatrixNames

Extract a vector of parameter names based on specified rows and columns
plot3DQtile

Build a persepctive plot or contour plot of a quantile of predicted values
plotCutoff

Plot sampling distributions of fit indices
plotPower

Plot sampling distributions of fit indices that visualize power
runMisspec

Draw actual parameters and model misspecification
simGamma

Create random gamma distribution object
simWeibull

Create random Weibull distribution object
simNorm

Create random normal distribution object
setOpenMxObject

Rearrange starting values for OpenMx
MatrixSet-class

Class "MatrixSet"
constantVector

Create a constant vector object
SimMissing-class

Class "SimMissing"
clean

Extract only converged replications in the result object
SimModel-class

Class "SimModel"
findRowZero

Find rows in a matrix that all elements are zero in non-fixed subset rows and columns.
divideObject

Make a division on each element of the object
defaultStartingValues

Make ad hoc starting values
findFactorTotalVar

Find factor total variances from regression coefficient matrix, factor (residual) correlations, and factor residual variances
continuousPower

Find power of model parameters when simulations have randomly varying parameters
subtractObject

Make a subtraction of each element in an object
plotDist

Plot a distribution of a distribution object or data distribution object
overlapHist

Plot overlapping histograms
validateObject

Validate whether the drawn parameters are good.
simF

Create random F distribution object
fitMeasuresChi

Find fit indices from the discrepancy values of the target model and null models.
getCutoff

Find cutoff given a priori alpha level
isRandom

Check whether the object contains any random parameters
combineObject

Combine by summing or binding two objects together.
runFit

Build a result object from analyzing real data
simSetPath

Create a set of matrices of parameter and parameter values to generate and analyze data that belongs to Path analysis model
summaryPopulation

Summarize the data generation population model underlying an object
simEqualCon

Equality Constraint Object
simExp

Create random exponential distribution object
toSimSet

Transform the analysis model object into the object for data generation
setPopulation

Set the data generation population model underlying an object
simMatrix

Create simMatrix that save free parameters and starting values, as well as fixed values
kurtosis

Finding excessive kurtosis
countMACS

Count the number of elements in the sufficient statistics
simNbinom

Create random negative binomial distribution object