runFit(simsem)
runFit()所属R语言包:simsem
Build a Monte Carlo simulation that the data-generation parameters are from the result of analyzing real data
数据生成参数实时数据分析的结果,建立一个Monte Carlo模拟
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function will analyze real data and use the result of the analysis to simulate data. Those simulated data will be analyzed by the same model. The result of the analyses will be saved in the result object, SimResult.
这个函数将真实的数据进行分析,并用模拟数据的分析结果。这些模拟数据通过相同的模型进行分析。分析的结果将保存的结果对象,SimResult的。
用法----------Usage----------
runFit(model, data, nRep=1000, misspec=new("NullSimMisspec"),
maxDraw=100, sequential=NA, facDist=new("NullSimDataDist"),
errorDist=new("NullSimDataDist"), indDist=new("NullSimDataDist"),
modelBoot=FALSE, seed=123321, silent=FALSE, multicore=FALSE,
cluster=FALSE, numProc=NULL, empiricalMissing=TRUE,
missModel=new("NullSimMissing"), usedStd=TRUE, analyzeModel=NULL)
参数----------Arguments----------
参数:model
Model object used in analyzing the real data and simulated data (if the analyzeModel below is not specified).
分析实时数据和模拟数据(如果analyzeModel下面没有指定)中使用的模型对象。
参数:data
Real data that will be used in the analysis
将在分析中使用的真实数据
参数:nRep
Number of replications.
复制数量。
参数:misspec
Model misspecification matrices that are created by simMisspecCFA, simMisspecPath, or simMisspecSEM.
模型误设的矩阵所建立的simMisspecCFA,simMisspecPath或simMisspecSEM。
参数:maxDraw
The maximum number of random drawn parameters and misspecification model until all parameters in the model are eligible (no negative error variance, standardized coefficients over 1).
随机绘制的参数和设定错误模型,在模型中,直到所有参数的最大数量有资格(没有负的误差方差,标准化系数大于1)。
参数:sequential
If TRUE, use a sequential method to create data such that the data from factor are generated first and apply to a set of equations to obtain the data of indicators. If FALSE, create data directly from model-implied mean and covariance of indicators.
如果TRUE,使用顺序的方法来创建数据,使得数据从因子首先产生的,并适用于一组方程,得到的数据的指标。如果FALSE,直接从创建数据模型隐含的均值和方差指标。
参数:facDist
A SimDataDist for a distribution of factors. Use when sequential is TRUE.
ASimDataDist的分布的因素。使用时sequential是TRUE。
参数:errorDist
A SimDataDist for a distribution of measurement errors. Use when sequential is TRUE
ASimDataDist的测量误差的分布。使用时sequential是TRUE
参数:indDist
A SimDataDist for a distribution of indicators. Use when sequential is FALSE.
ASimDataDist指标的分配。使用时sequential是FALSE。
参数:modelBoot
Use a model-based bootstrap approach to create data. See simData for further details.
使用基于模型的自举的方法来创建数据。见simData进一步的细节。
参数:seed
Seed number
种子数
参数:silent
TRUE if users do not wish to print number of replications during running the function.
TRUE,如果用户不希望,打印复制数量在运行过程中的功能。
参数:multicore
Use multiple processors within a computer. Specify as TRUE to use it.
使用中的计算机内的多个处理器。指定为TRUE使用。
参数:cluster
Not applicable now. Use for specify nodes in hpc in order to be parallelizable.
现在不适用。使用指定节点HPC为了并行化的。
参数:numProc
Number of processors for using multiple processors. If it is NULL, the package will find the maximum number of processors.
用于使用多个处理器的处理器数目。如果是NULL,包处理器的最大数量。
参数:empiricalMissing
Use the missing pattern from the real data imposing on the simulated data if empiricalMissing=TRUE. If FALSE, the missing pattern will be generated from the missing object specified in the missModel argument. If we need a complete data, the missModel argument can be specified as blank missing object, simMissing().
从实际的数据气势上的模拟数据丢失的模式,如果empiricalMissing=TRUE。 FALSE如果,缺少的格局将产生missModel参数中指定缺少的对象。如果我们需要一个完整的数据,missModel参数可以被指定为空白失踪对象,simMissing()的。
参数:missModel
A missing object used for data simulation. Only numImps attribute within the missing object is used if empiricalMissing=TRUE. All attributes are used (for generating missing data) if empiricalMissing=FALSE.
缺少对象用于数据模拟。只有numImps内缺少的对象的属性时使用empiricalMissing=TRUE。如果empiricalMissing=FALSE所有的属性都用于生成丢失的数据。
参数:usedStd
The standardized parameters are used for data generation if usedStd=TRUE. If usedStd=FALSE, unstandardized parameters are used.
标准化参数数据生成用于如果usedStd=TRUE。如果usedStd=FALSE,使用非标准的参数。
参数:analyzeModel
The SimModel that will be used to analyze the simulated data. If NULL, the model object from the model argument is used.
SimModel,将用于分析的模拟数据。如果NULL,从模型对象model参数使用。
Details
详细信息----------Details----------
This function can be used to implement the Monte Carlo approach for evaluating model fit proposed by Millsap (in press). This function will use the obtained parameter estimates as the real population parameters in a simulation study, put a trivial model misspecification in the real parameters, generate multiple simulated data, analyze those simulated data, and put it in the result object, SimResult. The fit indices distribution in the result object can be used for the model fit evaluation. The useful functions for model fit evaluation are plotCutoff, getCutoff, and pValue. If modelBoot is TRUE, the function will use the Bollen-Stine bootstrap method for data generation. See simData for further details of the Bollen-Stine bootstrap approach.
此功能可用于实现蒙特卡罗方法米尔萨普(记者)提出的评估模型拟合。此函数将使用获得的参数估计值,作为真正的人口参数的模拟研究,把一个简单的模型误,真正的参数,生成多个模拟数据,分析这些模拟数据,并把它在结果对象中,SimResult 。拟合指数分布,可用于在结果对象模型拟合评价。模型的拟合评价的有用的功能是plotCutoff,getCutoff和pValue。如果modelBootTRUE,功能使用数据生成的的博伦斯坦引导的方法。见simData为博伦斯坦引导的方法进一步详情。
值----------Value----------
SimResult that saves analysis results from simulated data.
SimResult,节省了从模拟数据的分析结果。
(作者)----------Author(s)----------
Sunthud Pornprasertmanit (University of Kansas; <a href="mailto:psunthud@ku.edu">psunthud@ku.edu</a>)
参考文献----------References----------
参见----------See Also----------
SimModel for analysis model specification
SimModel分析模型规范
SimResult for the type of resulting object
SimResult生成的对象的类型
实例----------Examples----------
## Not run: [#不运行:]
library(lavaan)
loading <- matrix(0, 9, 3)
loading[1:3, 1] <- NA
loading[4:6, 2] <- NA
loading[7:9, 3] <- NA
model <- simParamCFA(LY=loading)
SimModel <- simModel(model, indLab=paste("x", 1:9, sep=""))
u2 <- simUnif(-0.2, 0.2)
loading.trivial <- matrix(NA, 9, 3)
loading.trivial[is.na(loading)] <- 0
LY.trivial <- simMatrix(loading.trivial, "u2")
mis <- simMisspecCFA(LY = LY.trivial)
Output <- runFit(SimModel, HolzingerSwineford1939, 5, mis)
summary(Output)
out <- run(SimModel, HolzingerSwineford1939)
Output2 <- runFit(out, HolzingerSwineford1939, 5, mis)
# Bollen-Stine Bootstrap[博伦斯坦引导]
Output3 <- runFit(out, HolzingerSwineford1939, 5, modelBoot=TRUE)
# Bollen-Stine Bootstrap with trivial misspecification[博伦斯坦引导琐碎的设定错误]
Output4 <- runFit(out, HolzingerSwineford1939, 5, mis, modelBoot=TRUE)
# Example with multiple imputation[例如使用多重插补]
library(lavaan)
loading <- matrix(0, 11, 3)
loading[1:3, 1] <- NA
loading[4:7, 2] <- NA
loading[8:11, 3] <- NA
path <- matrix(0, 3, 3)
path[2:3, 1] <- NA
path[3, 2] <- NA
errorCov <- diag(NA, 11)
facCov <- diag(3)
param <- simParamSEM(LY=loading, BE=path, TE=errorCov, PS=facCov)
miss <- simMissing(pmMCAR=0.03, numImps=5)
usedData <- run(miss, PoliticalDemocracy)
model <- simModel(param, indLab=c(paste("x", 1:3, sep=""), paste("y", 1:8, sep="")))
out <- run(model, usedData, miss)
output <- runFit(model, usedData, 5, missModel=miss)
pValue(out, output)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|