找回密码
 注册
查看: 327|回复: 0

R语言 simFrame包 SimControl-class()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 02:43:55 | 显示全部楼层 |阅读模式
SimControl-class(simFrame)
SimControl-class()所属R语言包:simFrame

                                        Class "SimControl"
                                         类“SimControl”

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Class for controlling how simulation runs are performed.
一类用于控制如何进行模拟运行。


类对象----------Objects from the Class----------

Objects can be created by calls of the form new("SimControl", ...) or  SimControl(...).
可以创建对象通过调用的形式new("SimControl", ...)或SimControl(...)。


插槽----------Slots----------




contControl: Object of class "OptContControl"; a
contControl:类的对象"OptContControl";




NAControl: Object of class "OptNAControl"; a control
NAControl:对象类"OptNAControl";控制




design: Object of class "character" specifying  variables (columns) to be used for splitting the data into domains.  The  simulations, including contamination and the insertion of missing values
design:对象的类"character"指定变量(列)用于分裂的数据域。的模拟,包括污染和缺失值的插入




fun: Object of class "function" to be applied in each
fun:对象类"function"被应用在各个




dots: Object of class "list" containing additional
dots:对象类"list"包含额外的




SAE: Object of class "logical" indicating whether
SAE:类的对象"logical"指示是否


Details

详细信息----------Details----------

There are some requirements for fun.  It must return a numeric vector,  or a list with the two components values (a numeric vector) and  add (additional results of any class, e.g., statistical models).   Note that the latter is computationally slightly more expensive.  A  data.frame is passed to fun in every simulation run.  The  corresponding argument must be called x.  If comparisons with the  original data need to be made, e.g., for evaluating the quality of imputation  methods, the function should have an argument called orig.  If  different domains are used in the simulation, the indices of the current  domain can be passed to the function via an argument called domain.
有一些要求fun。它必须返回一个数值向量或列表的两个组成部分values(数字向量)和add(附加任何类,例如,统计模型)。请注意,后者是计算稍微更昂贵。 Adata.frame传递给fun在每次模拟运行。对应参数必须叫做x。例如,如果需要与原始数据进行比较,评估质量的估算方法,函数应该有一个参数叫做orig。如果模拟中使用的不同的域,在当前域的指标,可以通过功能通过参数称为domain。

For small area estimation, the following points have to be kept in mind.  The  design for splitting the data must be supplied and SAE  must be set to TRUE.  However, the data are not actually split into  the specified domains.  Instead, the whole data set (sample) is passed to  fun.  Also contamination and missing values are added to the whole  data (sample).  Last, but not least, the function must have a domain  argument so that the current domain can be extracted from the whole data  (sample).
对于小面积的估计,必须牢记以下几点。的design分裂的数据必须提供和SAE设置为TRUE。然而,该数据实际上不是分成指定的域。相反,整个数据集(样本)被传递给fun。污染和遗漏值将被添加到整个数据(样本)。最后,但并非最不重要的一点是,该函数必须有一个domain参数,以便可以提取当前域的整个数据(样本)。

In every simulation run, fun is evaluated using try.  Hence  no results are lost if computations fail in any of the simulation runs.
在每一个仿真的运行,fun被评为使用try。因此,没有结果都将丢失,如果计算在任何的模拟运行失败。


访问和修改方法----------Accessor and mutator methods----------




getContControl signature(x = "SimControl"): get slot
getContControlsignature(x = "SimControl"):得到插槽




setContControl signature(x = "SimControl"): set slot
setContControlsignature(x = "SimControl"):设定插槽




getNAControl signature(x = "SimControl"): get slot
getNAControlsignature(x = "SimControl"):得到插槽




setNAControl signature(x = "SimControl"): set slot
setNAControlsignature(x = "SimControl"):设定插槽




getDesign signature(x = "SimControl"): get slot
getDesignsignature(x = "SimControl"):得到插槽




setDesign signature(x = "SimControl"): set slot
setDesignsignature(x = "SimControl"):设定插槽




getFun signature(x = "SimControl"): get slot
getFunsignature(x = "SimControl"):得到插槽




setFun signature(x = "SimControl"): set slot
setFunsignature(x = "SimControl"):设定插槽




getDots signature(x = "SimControl"): get slot
getDotssignature(x = "SimControl"):得到插槽




setDots signature(x = "SimControl"): set slot
setDotssignature(x = "SimControl"):设定插槽




getSAE signature(x = "SimControl"): get slot
getSAEsignature(x = "SimControl"):得到插槽




setSAE signature(x = "SimControl"): set slot
setSAEsignature(x = "SimControl"):设定插槽


方法----------Methods----------




clusterRunSimulation signature(cl = "ANY",        x = "data.frame", setup = "missing", nrep = "numeric",
clusterRunSimulation <CODE>签名(CL =“ANY”,X =“数据框”,设置=“失踪”,NREP =“数字”,




clusterRunSimulation signature(cl = "ANY",        x = "data.frame", setup = "VirtualSampleControl", nrep = "missing",
clusterRunSimulation <CODE>签名(CL =“ANY”,X =“数据框”,设置=“VirtualSampleControl”,NREP =“失踪”




clusterRunSimulation signature(cl = "ANY",        x = "data.frame", setup = "SampleSetup", nrep = "missing",
clusterRunSimulation <CODE>签名(CL =“ANY”,X =“数据框”,设置=“SampleSetup”,NREP =“失踪”




clusterRunSimulation signature(cl = "ANY",        x = "VirtualDataControl", setup = "missing", nrep = "numeric",
clusterRunSimulation <CODE>签名(CL =“ANY”,X =“VirtualDataControl”设置=“失踪”,NREP =“数字”,




clusterRunSimulation signature(cl = "ANY",        x = "VirtualDataControl", setup = "VirtualSampleControl",        nrep = "numeric", control = "SimControl"): run a simulation experiment
clusterRunSimulationsignature(cl = "ANY",        x = "VirtualDataControl", setup = "VirtualSampleControl",        nrep = "numeric", control = "SimControl"):运行一个模拟实验




head signature(x = "SimControl"): currently returns
headsignature(x = "SimControl"):目前返回




runSimulation signature(x = "data.frame",        setup = "VirtualSampleControl", nrep = "missing",
runSimulation <CODE>签名(X =“数据框”,设置=“VirtualSampleControl”,NREP =“失踪”




runSimulation signature(x = "data.frame",        setup = "SampleSetup", nrep = "missing", control = "SimControl"): run a
runSimulationsignature(x = "data.frame",        setup = "SampleSetup", nrep = "missing", control = "SimControl"):运行




runSimulation signature(x = "data.frame",        setup = "missing", nrep = "numeric", control = "SimControl"): run a
runSimulationsignature(x = "data.frame",        setup = "missing", nrep = "numeric", control = "SimControl"):运行




runSimulation signature(x = "data.frame",        setup = "missing", nrep = "missing", control = "SimControl"): run a
runSimulationsignature(x = "data.frame",        setup = "missing", nrep = "missing", control = "SimControl"):运行




runSimulation signature(x = "VirtualDataControl",        setup = "missing", nrep = "numeric", control = "SimControl"): run a
runSimulationsignature(x = "VirtualDataControl",        setup = "missing", nrep = "numeric", control = "SimControl"):运行




runSimulation signature(x = "VirtualDataControl",        setup = "missing", nrep = "missing", control = "SimControl"): run a
runSimulationsignature(x = "VirtualDataControl",        setup = "missing", nrep = "missing", control = "SimControl"):运行




runSimulation signature(x = "VirtualDataControl",        setup = "VirtualSampleControl", nrep = "numeric",
runSimulation <CODE>签名(X =“VirtualDataControl”,设置=“VirtualSampleControl”的,NREP =“数字”,




runSimulation signature(x = "VirtualDataControl",        setup = "VirtualSampleControl", nrep = "missing",
runSimulation <CODE>签名(X =“VirtualDataControl”,设置=“VirtualSampleControl”的,NREP =“失踪”




show signature(object = "SimControl"): print the
showsignature(object = "SimControl"):打印




summary signature(object = "SimControl"): currently
summarysignature(object = "SimControl"):目前




tail signature(x = "SimControl"): currently returns
tailsignature(x = "SimControl"):目前返回


UML类图----------UML class diagram----------

A slightly simplified UML class diagram of the framework can be found in  Figure 1 of the package vignette An Object-Oriented Framework for  Statistical Simulation: The R Package simFrame.  Use  vignette("simFrame-intro") to view this vignette.
稍微简单的UML类图的框架,可以发现在图1的包小插曲统计模拟方法的一种面向对象的框架:R封装simFrame。使用vignette("simFrame-intro")查看这个小插曲。


(作者)----------Author(s)----------


Andreas Alfons



参考文献----------References----------

Statistical Simulation: The R Package <code>simFrame</code>. Journal of  Statistical Software, 37(3), 1&ndash;36. URL  http://www.jstatsoft.org/v37/i03/.

参见----------See Also----------

runSimulation, "SimResults"
runSimulation,"SimResults"


实例----------Examples----------


#### design-based simulation[###设计为基础的模拟]
set.seed(12345)  # for reproducibility[可重复性]
data(eusilcP)    # load data[加载数据]

## control objects for sampling and contamination[#控制对象的采样和污染]
sc <- SampleControl(size = 500, k = 50)
cc <- DARContControl(target = "eqIncome", epsilon = 0.02,
    fun = function(x) x * 25)

## function for simulation runs[功能模拟运行]
sim <- function(x) {
    c(mean = mean(x$eqIncome), trimmed = mean(x$eqIncome, 0.02))
}

## combine these to "SimControl" object and run simulation[#结合到“SimControl”对象和运行仿真]
ctrl <- SimControl(contControl = cc, fun = sim)
results <- runSimulation(eusilcP, sc, control = ctrl)

## explore results[#探索的结果]
head(results)
aggregate(results)
tv &lt;- mean(eusilcP$eqIncome)  # true population mean[真正的人口是什么意思]
plot(results, true = tv)



#### model-based simulation[###基于模型的仿真]
set.seed(12345)  # for reproducibility[可重复性]

## function for generating data[#,用于产生数据的功能]
rgnorm <- function(n, means) {
    group <- sample(1:2, n, replace=TRUE)
    data.frame(group=group, value=rnorm(n) + means[group])
}

## control objects for data generation and contamination[#控制对象的数据生成和污染]
means <- c(0, 0.25)
dc <- DataControl(size = 500, distribution = rgnorm,
    dots = list(means = means))
cc <- DCARContControl(target = "value",
    epsilon = 0.02, dots = list(mean = 15))

## function for simulation runs[功能模拟运行]
sim <- function(x) {
    c(mean = mean(x$value),
        trimmed = mean(x$value, trim = 0.02),
        median = median(x$value))
}

## combine these to "SimControl" object and run simulation[#结合到“SimControl”对象和运行仿真]
ctrl <- SimControl(contControl = cc, design = "group", fun = sim)
results <- runSimulation(dc, nrep = 50, control = ctrl)

## explore results[#探索的结果]
head(results)
aggregate(results)
plot(results, true = means)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-5-24 06:23 , Processed in 0.034336 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表