当使用seed = NA时,如何找出MICE R-package选择哪个种子进行多重插补? [英] How to find out which seed the MICE R-package chose for multiple imputation when using seed=NA?

查看:262
本文介绍了当使用seed = NA时,如何找出MICE R-package选择哪个种子进行多重插补?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对一个名为"mydata"的数据帧进行多次插补.使用以下代码:

I´m doing a multiple imputation for a dataframe named "mydata" with this code:

图书馆(小鼠)

library(mice)

imp< -mice(mydata,pred = pred,method ="pmm'',m = 10)

imp<-mice(mydata,pred=pred,method="pmm", m=10)

因为为此的默认参数是函数"seed = NA",所以种子编号是随机选择的.我想保持这种状态,因为我不知道应该选择哪个数字作为种子.但是对于复制,我想知道此功能为我选择了哪种种子.是否有可能检查中位物体的小鬼"玩具.对于种子价值?还是我应该只使用随机数生成器并将种子设置为生成的值?

Because the default argument for this is function is "seed=NA", the seed-number is chosen randomly. I would like to keep it like this, because i don´t know which number i should choose as a seed. But for replication i would like to know which seed this function chose for me. Is there a possibility to inspect the mids-object "imp" for the seed-value? Or should i just use a random number generator and set the seed to a generated value?

推荐答案

如果您查看文档,则没有mice函数的set.seed自变量之类的东西.但是,有一个seed参数采用整数.如果单独使用,则整数是随机生成的.

If you look at the documentation, there is no such thing as a set.seed argument for mice function. There is, however a seed argument which takes an integer. If left alone, the integer is generated randomly.

An integer that is used as argument by the `set.seed()` for offsetting the random
number generator. Default is to leave the random number generator alone

您可以选择自己的整数.如果您选择什么,请尝试使用幸运数字或一些随机整数,以系统的天空或体系结构为限.

You can choose your own integer. If you're stuck at what to choose, try your lucky number, or some random integer, with sky or architecture of your system being the limit.

该函数以以下方式设置种子,如文档中所述,它翻译为仅在指定时设置种子,否则不处理".

The function sets seed in the following manner, which translates to "set seed only if specified, otherwise leave alone" as mentioned in the documentation.

   if (!is.na(seed))
        set.seed(seed)  ## FEH 1apr02

这篇关于当使用seed = NA时,如何找出MICE R-package选择哪个种子进行多重插补?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆