setNA(simFrame)
setNA()所属R语言包:simFrame
Set missing values
设置缺失值的
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Generic function for inserting missing values into data.
通用函数为插入缺失值的数据。
用法----------Usage----------
setNA(x, control, ...)
## S4 method for signature 'data.frame,NAControl'
setNA(x, control, i)
参数----------Arguments----------
参数:x
the data in which missing values should be inserted.
应该被插入其中的数据丢失的值。
参数:control
a control object inheriting from the virtual class "VirtualNAControl" or a character string specifying such a control class (the default being "NAControl").
控制对象从虚拟类"VirtualNAControl"或一个字符串指定控制类(默认是"NAControl")继承。
参数:i
an integer giving the element or row of the slot NArate of control to be used as missing value rate(s).
插槽的元素或行,一个整数,NAratecontrol作为缺失值率(S)。
参数:...
if control is a character string or missing, the slots of the control object may be supplied as additional arguments. See "NAControl" for details on the slots.
如果control是一个字符串或丢失,控制对象的插槽,可以提供额外的参数。见"NAControl"的插槽。
Details
详细信息----------Details----------
In order to extend the framework by a user-defined control class "MyNAControl" (which must extend "VirtualNAControl"), a method setNA(x, control, i) with signature 'data.frame, MyNAControl' needs to be implemented.
为了扩展该框架由用户定义的控件类"MyNAControl"(必须扩大"VirtualNAControl"),方法setNA(x, control, i)签名'data.frame, MyNAControl'需要实现。
值----------Value----------
A data.frame containing the data with missing values.
Adata.frame包含数据的缺失值。
方法----------Methods----------
x = "data.frame", control = "character" set missing values using a control class specified by the character string control.
x = "data.frame", control = "character"设置缺少使用控制类指定的字符串control值。
x = "data.frame", control = "missing" set missing values using a control object of class "NAControl". Its slots may be supplied as
x = "data.frame", control = "missing"设定值的控制对象类"NAControl"失踪。它的时隙可以提供
x = "data.frame", control = "NAControl" set missing values as
x = "data.frame", control = "NAControl"设置缺失值
注意----------Note----------
Since version 0.3, setNA no longer checks if auxiliary variable(s) with probability weights are numeric and contain only finite positive values (sample still throws an error in these cases). This has been removed to improve computational performance in simulation studies.
自0.3版以来,setNA,“不再检查是否使用辅助变量(S)的概率为权数,是数字只包含有限的正值(sample在这种情况下仍然会抛出一个错误)。这已被删除,以提高计算性能模拟研究。
(作者)----------Author(s)----------
Andreas Alfons
参考文献----------References----------
Statistical Simulation: The R Package <code>simFrame</code>. Journal of Statistical Software, 37(3), 1–36. URL http://www.jstatsoft.org/v37/i03/.
参见----------See Also----------
"NAControl", "VirtualNAControl"
"NAControl","VirtualNAControl"
实例----------Examples----------
data(eusilcP)
eusilcP$age[eusilcP$age < 0] <- 0 # this actually occurs[这实际上是发生]
sam <- draw(eusilcP[, c("id", "age", "eqIncome")], size = 20)
## using control objects[#使用控制对象]
# missing completely at random[完全随机缺失]
mcarc <- NAControl(target = "eqIncome", NArate = 0.2)
setNA(sam, mcarc)
# missing at random[随机缺失]
marc <- NAControl(target = "eqIncome", NArate = 0.2, aux = "age")
setNA(sam, marc)
# missing not at random[缺少的不是随机的]
mnarc <- NAControl(target = "eqIncome",
NArate = 0.2, aux = "eqIncome")
setNA(sam, mnarc)
## supply slots of control object as arguments[#电源插槽的控制对象作为参数]
# missing completely at random[完全随机缺失]
setNA(sam, target = "eqIncome", NArate = 0.2)
# missing at random[随机缺失]
setNA(sam, target = "eqIncome", NArate = 0.2, aux = "age")
# missing not at random[缺少的不是随机的]
setNA(sam, target = "eqIncome", NArate = 0.2, aux = "eqIncome")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|