View on GitHub


R package for simulated structural equation modeling

Download this project as a .zip file Download this project as a tar.gz file

Version History (Technical)

Version 0.5-13 06/06/16

Version 0.5-12 02/29/16

Version 0.5-11 06/29/15

Version 0.5-9 12/03/14

Version 0.5-8 10/03/14

Version 0.5-5 03/02/14

Version 0.5-3 03/17/13

Version 0.5-2 03/09/13

Version 0.5-1 02/17/13

Version 0.5-0 02/10/13

Version 0.4-999 1/6/13

Version 0.4-6 12/30/12

Version 0.4-5 12/18/12

Version 0.4-4 11/28/12

Version 0.4-3 11/19/12

Version 0.4-2 10/29/12

Version 0.4-1 10/24/12

Version 0.4-0 10/24/12

Version 0.3-14 10/22/12

Version 0.3-13 10/17/12

Version 0.3-12 10/15/12

Version 0.3-11 09/26/12

Version 0.3-10 09/25/12

Version 0.3-9 09/24/12

Version 0.3-8 09/24/12

Version 0.3-7 09/19/12

Version 0.3-6 09/13/12

Version 0.3-5 09/06/12

We have too many changes so that we cannot list them all. In short, more than 50% of the codes in 0.2 family are rewritten including almost all of the core functions. Here are a short list of changes.

Version 0.2-9 09/12/12

- Update the code that reflects the change in the copula package.

Version 0.2-8 07/06/12

- Fix bugs in the validatePath function - Delete the indProd and residualCovariate functions from the package (move to the semTools package)

Version 0.2-7 06/17/12

- Fix bugs in the cov2corMod, writeLavaanCode, runLavaan, and likRatioFit - Add three new examples on nested model comparison

Version 0.2-6 06/17/12

- Make the anova method comparing SimModelOut to report difference in AIC and BIC. - Add the pValueNested to provide the p-value for nested model comparison using Monte Carlo approach - Add the runFitParam method to create SimResultParam directly from the data analysis - Add the summaryMisspec function to report the misspecification containing in the parameter result object - Fix the summary and summaryFit method for a bug in printing fit indices cutoffs - Make the simResultParam function to be less time-consuming - Fix the bug in getCondQtile function when multiple values of xval is passed - Fix a bug in cov2corMod when sometimes it reads the target matrix as a vector - Make getPowerFitNested function to be much quicker - Add getCutoffNonNested, plotCutoffNonNested, getPowerFitNonNested, and plotPowerFitNonNested for non-nested model comparison. The varying parameter feature are not implemented in these functions yet. - Add pValueNonNested and likRatioFit for non-nested model comparison based on two analysis results - Fix the bug involving all.equal functions that does not provide a FALSE value

Version 0.2-5 06/13/12

- Make the getPowerFit and plotPowerFit function to be much quicker - The xval argument in the getCondQtile can be specified as "all" in order to find the conditional quantiles of all independent variables values. - Fix the bug in the summaryFit function - Fix the bug in the runRep and simResult when a list of data.frame is passed in the objData argument. - Provide an error message when a result object has no converged replication. - Add two examples about power in rejecting misspecified models

Version 0.2-4 06/11/12

- Add the pMiss slot in the SimModelOut class to save the percent missing of each variable - Change the clean function to extract multiple result objects by simultaneously convergent replications. - Change the output style of the anova method and adding the result when a varying parameter exists. - Improve the getPowerFit and plotPowerFit functions to account for a varying parameter. - Add the getCutoffNested and plotCutoffNested functions to find the cutoffs in nested model comparison - Add the getPowerFitNested and plotPowerFitNested functions to find the power in rejecting nested model when the nested model is not true.

Version 0.2-3 06/06/12

- Fix the runRep method to assign the random seed to the appropriate environment - Fix the writeLavaanConstraint function to account for mean constraints - Rewrite the summary method for the SimResult class by calling summaryFit function - Add the summaryFit function to directly provide the information about fit indices

Version 0.2-2 06/05/12

- Change the simMissing function and SimMissing class to save the additional arguments to be passed to Amelia package. - Change the runMI function to take additional arguments to be passed to Amelia package - Change the simResult function to create L'Ecuyer method of random number seed and pass to runRep function. Then, the runRep function will change the seed based on the L'Ecuyer random number. - (To be released) The functions in bind.R and parTable.R files will be used for the new design of simsem

Version 0.2-1 05/28/12

- Change the names of getPower and plotPower functions to getPowerFit and plotPowerFit - Add the pred argument for the continuousPower function to take the independent variables' values - Add the getCondQtile function to find the conditional quantile value - Improve the getCutoff function to find conditional fit indices - Change the summary method for the SimResult class when the sample size or percent missing is varied: providing conditional fit indices' cutoffs. - Fix the bug in the plotCutoff function - Add the findPower and findTargetPower functions to give the value of varying parameters that provides the desired power. - Add the getPower function as the automated function for the continuousPower function - Add the plotPower function to plot the power of parameters against varying parameters - Fix the bug in standardize function - Change the keepScale argument in the SimDataDist class to take a vector of logical values instead of a single logical value - Change the run-SimDataDist and extract-SimDataDist methods to handle multiple logical values in the keepScale attribute - Add and fix all documentation - Add Example 17, 18, and 19 to illustrate the varying parameter simulation in the vignette

Version 0.2-0 05/18/12

- The version is the first uploaded into CRAN. - All examples in the documentations are edited to reduce the amount of time running through all examples. For example, the numbers of replications in most examples are 5. - Add Example 16 in the vignette and proofread all examples in the vignette

Version 0.1-6 05/15/12

- Change the second argument of the SimMatrix, SimVector, and SymMatrix classes from param to value. - Change the second argument of the constructor of those classes to value, as well as the adjust function. - Change the way to save the distribution objects in those classes as a text containing an expression that can be evaluated directly, instead of an object name. By this way, the random distribution object can be built and run in hpc. - Add checkInputValue, checkInputValueVector, and toFunction functions to change a distribution object name to an expression - Add suppressWarnings to all codes involving with the cor2cov function.

Version 0.1-5 05/14/12

- Add the optMisfit and numIter attributes in the SimMisspec class to account for the optimization method for selecting the set of misspecified parameters - Change simMisspecCFA, simMisspecPath, and simMisspecSEM to account for the new attributes - Change the runMisspec function to account for the optimization method to find a set of misspecification - Add isRandom function to check whether an object has a random parameter - Optimize the simResult function to draw parameter only once if there is no random parameter - Fix the bug on the validatePath function - Add optMax, optMin, and optNone keywords in the getKeywords functions to list the words for minimization, maximization, and none in the optMisfit argument.

Version 0.1-4 05/10/12

- Add toSimSet and simData methods using SimRSet class, as well as change the documentation - Fix a minor bug in popMisfit - Fix the error in documentation of popMisfitMACS and popDiscrepancy

Version 0.1-3 05/06/12

- Use cor2cov in the lavaan package - Fix the bugs in findFactorTotalVar, findFactorToalCov, and findFactorResidualVar functions when using the cor2cov from lavaan - Add the show method to prevent flooding of all objects in the screen when users typing an object name - Add usedFitPop in the getKeywords to set the default of the used population misfit - Fix the constrainMatrices function to getting rid of inaccurate object when the target object is equally constrained (such as delete RTE when TE is constrained). - Fix the run(SimSet) method to use the misBeforeFill argument - Fix the runMisspec function to make six different orders of misBeforeFill, conBeforeMis, and conBeforeFill - Change the conBeforeMis and misFitBound arguments from the SimData class (as well as the simData and runFit functions) to SimMisspec class (as well as simMisspecCFA, simMisspecPath, and simMisspecSEM functions) - Add misfitType and misBeforeFill arguments in the SimMisspec class (as well as simMisspecCFA, simMisspecPath, and simMisspecSEM functions) - Add conBeforeFill argument in the SimEqualCon class - Add vectorizeObject method for the MatrixSet class - Add two new classes: SimGenLabels and SimResultParam - Add the makeLabels method for the SimSet class and provide the SimGenLabels that saves the labels in the data generation parameterization - Add countMACS, plotMisfit, and simResultParam functions - Fix the bug in countFreeParameters, as well as adding the method for SimEqualCon and SimREqualCon - Separate the drawParameters function into drawParameters and drawParametersMisspec functions - Add popMisfit methods as well as popMisfitMACS and popDiscrepancy function - Fix the summary method for SimModel to provide the accurate value of free parameters. - Change the documentation accordingly - Use formatR for all codes - To do: Connect SimResultParam to SimResult

Version 0.1-2 05/03/12

- Write documentations of almost all functions - Change the name of fitMeasures function to fitMeasuresChi - Get rid of the header of the R folders - Use formatR to make code look pretty

Version 0.1-1 04/20/12

- Add modelBoot and realData attribute in the SimData class. Change the runFit and simData to take these arguments accordingly. - Change the createData function to implement the Bollen-Stine bootstrap approach for data generation. - Change the documentation for this change accordingly - Fix the simResult function bug when using the objSet argument

Version 0.1-0 04/19/12

- Change order of the simData function from (n, param, ...) to (param, n, ...) and change the simData function to simData methods - Allow SimModelOut (instead of SimSet) as the output of the simData methods - Allow SimModelOut (instead of SimSet) as the output of the simModel methods - Add toSimSet function to change SimModelOut to SimSet - Add indicatorLab as the attribute of SimData, SimDataOut, SimModelOut - Change how to create SimParam class in the createFreeParameters function - Add logical argument in the imposeMissing function to impose missing by the matrix of logicals - Add SimFunction and NullSimFunction Classes for transforming data during the simulation - Add summary, isNullObject and run methods for the SimFunction class - Change simResult and runRep functions to account for SimFunction class - Add simFit methods to run a Monte Carlo simulation based on the result of data analysis - Add continuousPower function to calculate the power of each parameter with respect to sample size and percent missing - Add indProd function to make the products of indicators in order to make latent interaction construct - Add residualCovariate function to residualize variables to control the covariate - Fix WriteLavaanCode bug that cannot analyze the data with covariate - Change indicatorLab argument name to indLab - Write and fix all documentations for the this version - Add covAsAux in the simMissing function and class to choose whether using the covariate as auxiliary variables - Change the name of SimFreeParam class to SimParam - Add prAttr argument in the imposeMissing function for percent attrition - Change the way to specify the default fit indices by putting into getKeywords function instead of listing it all the time - Change pValue function to methods and add the routine to compare between the SimModelOut class and the SimResult class - Change the runRep and simResult function to save the data generation model and pass it to the result object - Add extract methods for data frame to extract selected indicators or factors - Add cov2corMod function and Change cov2cor to cov2corMod in the code to handle zero variances - Add summaryPopulation, getPopulation, and setPopulation methods as well as their documentations. - Fix a bug in the reduceMatrices function - Rename 8 files that use to find indicators/factors means/totalVar/ResidualVar/Intercept. Change attribute names to make more sense. Make all eight functions public and write the documentation accordingly. - IMPORTANT BUG: fix a problem in findIndResidualVar and findIndTotalVar that use PS instead of model-implied factor covariance in the package. Fix the fillParam function accordingly. Fix the bug in expandMatrices as well. - Fix a minor bug in fillParam that do not calculate VPS in CFA model. - Add findFactorTotalCov to find model-implied covariance from regression coefficient matrix and residual covariance matrix. - Make findPossibleFactorCor and findRecursiveSet public and make the documentation accordingly. - Delete combineVectorExoEndo, contain, cor2cov, equalWhich, extractDiag, extractLine, isNAVector, writeLavaanConstraint - Rename countRandomObject to countFreeParameters - Rename extractLavaanSummary to extractLavaanFit - Rename transform.constraint to writeLavaanConstraint - Rename findOpenMxValues to setOpenMxObject - Rename findFitIndicesOpenMx to extractOpenMxFit - Rename transformConstraint to writeLavaanConstraint - Rename typeConstraint to writeLavaanIndividualConstraint - Add and update code description of all files; Change some function code to make them more elegant

Version 0.0-11 04/05/12

- Add clean function to remove nonconverged replications from the simResult before computing the output. - Use clean function for getCutoff, getPower, plotCutoff, plotPower, summary, and summaryParam functions/methods before analyzing SimResult object - Add plotQtile function to plot a quantile of Y given a value of X - Add plot3DQtile function to plot a quantile of Z given a value of X and Y (can be either contour plot or perspective plot) - Add n, pmMCAR, pmMAR, objSet arguments for simResult for varying n, pmMCAR, pmMAR in the simResult and an option to specify simSet instead of specifying simData and simModel - Change name simData, simModel, simMissing to objData, objModel, objMissing in simResult and runRep function - For run-SimMissing, add pmMCAR and pmMAR arguments to post hocly overwrite the percent missing - Add n, pmMCAR, and pmMAR as attributes of the SimResult class - Specify data.frame with 0 row or 0 column as null object in data.frame class - Add correlation between n/pmMCAR/pmMAR and parameter estimate and standard error in summaryParam-SimResult method - Add correlation between fit indices and n/pmMCAR/pmMAR in summary-SimResult method - Change the documentation of SimResult and plotCutoff for the changes. - Change all function names containing dots into camelCase. - Change to be compatible with R 2.15 - Add simParamCFA, simParamPath, simParamSEM functions to create parameters for data analysis (no starting values for creating data).

Version 0.0-10 03/31/12

- Make SimDataOut, SimModelOut, and SimResult have sample size argument (n). - Change run, createData, simResult functions to save sample size in the returning class. - Add miPoolChi to pool chi-square statistics - Change miPool to pool chi-square statistics by the previous functions and add compute fit indices - Add fitMeasures function to compute fit indices - Explain the pooling procedure in miPool.Rd

Version 0.0-9.1 03/31/12

- Fixing the bug that free the exogenous factor correlation when we actually fixed it.

Version 0.0-9 03/11/12

- Adding anova method for nested and nonnested comparison and its help page. - Changing code in run(SimSet), run(SimMisspec), run.misspecified to be more efficient by adding fillParam function - Change the get.keywords function to provide only necessary code (do not provide different inputs for different in lower or upper cases) - Make match.keyword code to be case-insensitive - Adding PS, TE, TD, PH, TH for covariance matrix in SimSet and MatrixSet classes. The reassign.names, constrain.matrices, all SimSet and SimMisspec constructors, reduce.matrices, expand.matrices, are changed accordingly. - The help page of SimSet-class, SimMisspec-class, and all of their constructors. - Debug miPool.R that has a problem when a matrix or a vector contains only one element. - Debug imposeMissing.R that has a problem when there is no covariate.

Version 0.0-8 03/05/12

- Change the write.lavaan.code function to handling auxiliary variables - Make the writeLavaanNullCode function to write a null model - Add the indicatorLab, factorLab, and auxiliary arguments in simModel function and SimModel class - Make the run-SimModel method to be able to select some variables to analyze - Fix a bug in the imposeMissing, summary-SimSet, miPool, and createData function - Make runMI be able to select some variables as auxiliary variables - Add extract method to select a part of the SimMatrix, SimVector, and SimSet. - Fix the help page for simModel and add the help page for the extract method - Change SimSet and SimMisspec correlation arguments to have leading R (PH -> RPH, PS -> RPS, TD -> RTD, TE -> RTE) - Allow setting the overall variance as 0 to mean no residual or measurement errors. - Changing how to handle MAR to threshold method - Adding two examples on auxiliary variable/MAR and single-indicator factor - Make the miPoolVector function public and make the manual page.

Version 0.0-7.1 02/27/12

- Fix a bug in validate.covariance, runRep, run-SimDataDist

Version 0.0-7 02/26/12

- Add the indicatorLab, errorLab, and factorLab arguments in the run-SimModel method to analyze real data - Fix a bug in the runRep function - For a complete data, listwise is used as default, instead of fiml. - Add the SimDataDist class for modeling data distribution in factors, errors, or indicators (including its null class) - Adding sequential method to create data starting from factors and adding up until getting the values of indicators. - Adding extract method for extract elements of SimDataDist or matrix - Adding many new distributions: imBeta, SimBinom, SimCauchy, SimChisq, SimExp, SimF, SimGamma, SimGeom, SimHyper, SimLnorm, SimLogis, SimNbinom, SimPois, SimT, SimWeibull. Including classes, constructors, summary, summaryShort, and run methods - Adding plotDist function for plot distribution or plot SimDataDist - Adding make.labels method for distribution objects - Change the name of create.implied.MACS to createImpliedMACS and make it public - Adding Examples 8 and 9 in the introduction manual for accounting for nonnormal distributed data. - Adding the estimator option in the SimModel object - Change runLavaan to put default values for all outputs first. - Add functiions to find skewness and excessive kurtosis from data and distribution object

Version 0.0-6 02/21/12

- Add standardized coefficient in the SimModelOut summary and in the SimResult attribute. - Fix the bug that data does not contain model misspecification when users actually specify - simResult will not parallelize in generating parameters but parallelize in generating data. - use clusterApplyLB for parallization in Windows but mclapply for other OS platforms - Fix minor bugs in the overlap.hist function and write.lavaan.code function - Change how to write code in the run-SimData method - Add welcome message when loading the program! - Fix for passing any non-positive definite data # Error: Unserialize example 3 with X-side

Version 0.0-5.0 02/09/12

- Handle warnings from the summaryParam function - Handle warnings and errors from the examples of imposeMissing function - Change the way to run simResult function to facilitate Rmpi in the future (using the runRep function) - Change miPool to pool the SimModelOut class - Change the order of the simResult function from (simData, simModel, simMissing, nRep) to (nRep, simData, simModel, simMissing). The examples and manual are changed accordingly. - Add the SimModelMIOut (with NullSimModelOut) class which is the child class of the SimModelOut class - Change the is.null.object and summaryParam functions for the SimModelMIOut class - Add two new examples on the introduction about missing data - Comment out the runOpenMx function because we will not implement OpenMx now - Fix bugs in reduce.matrices - Add SimMissing class with the run and the summary functions - Adjust the convergence checking in the runLavaan function according to the lavaan chagnes - Add the simResult function parallelizable

Version 0.0-4.0 11/17/11

- Add imposeMissing.R to package for imposing missing data. - Add runMI.R to package for running multiple imputation on missing data sets and managing the result pooling - Add miPool.R: pools MI results

Version 0.0-3.0 11/17/11

- Patrick builds simsem and haphazardly increases the version number without documenting the additional functionality.

Version 0.0-2.1 11/16/11

- Add SimDataOut class. The constructor of this class is run(simData, dataOnly=FALSE). - run-simModel.c can take objects from SimDataOut class and analyze bias in parameter estimates and whether confidence intervals cover the underlying parameter values. - All summary methods are improved to be more readable and more informative. - summary-SimDataOut.c is added - summaryParam-SimModelOut.c is added. - summaryParam-SimResult.c is modified to provide average parameter values, standard deviation of parameter values, average bias, standard deviation of bias, percentage coverage, relative bias, relative bias of SE, and standardized bias. Last three is provided if setting detail=TRUE. - summaryParam documentation file is modified accordingly. - SimModelOut.c and SimResult.c are changed to have paramValue attributes. - subtractObject.f is written to subtract two sets of parameter values. - Update the vignette by explaining the output from summary.f - Bug fixes in, simSetCFA.f, simSetPath.f, simSetSEM.f that did not free error variances and measurement intercepts when using default. - Change the name of constant.vector.f --> constantVector.f - Add freeVector.f to create vector of free parameters with starting values. Existing Problem: In SEM model, total endogenous factor variances are fixed as 1 in data model but, instead, residual factor variances are fixed as 1 in the estimation. Therefore, high bias in factor loading and measurement error variances in endogenous side. Change in parameter values are needed. (Fixed by the standardize method 03/05/12) simsem, Version 0.0-2.0 11/15/11 - Change all public function names and public function arguments to camelCase (private functions still have bad naming) - Change the names and attributes of all public and private classes. - Change file names according to the name changes. All names changes details are in the simsemNameChangeToV0.0-2.xls - All documentation are changed according to the name changes. - Use \itemize and \enumerate appropriate to the context in documentation files - simResult.f can take list of data frame - Make silent argument in simResult.f to be better (some error messages still appear) - Update the vignette according to the name changes and comments from Maurico - Add the function recap section in each example in the vignette.

Version 0.0-1.8 10/12/11

* Add simAnalysis class into the package * debug constrain.matrices(list, simConstraint) when constrained LX matrix * Add vectorize functions * Add combine.object(freeParamSet, list) where list is the lavaan object * Change simResult class to save parameter estimates and standard errors * Change find.cutoff, find.power, plot.cutoff, and plot.power according to the change in the simResult class * Add the summary.parameters function for the SimResult class * Add the documentation of the simAnalysis class and the summary.parameters function * Update the vignette on the summary.parameters function

Version 0.0-1.7 10/11/11

* Write all documents of public functions and public classes, including all links within the help files. * Write comments on some functions about the purposes, arguments, and return values. * Write comments on all classes about the purposes, constructor, and its arguments. * Delete visualize method and write plot.cutoff instead. * Add find.power and plot.power methods. * Add summary of simModel and simResult * Update the vignette, including the example of power analysis, add sections on help files and give us feedback. Update object diagram.