问题标签 [r-mice]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
685 浏览

r - 在 R 中使用鼠标会改变虚拟编码

我正在尝试将miceR 中的包用于一个项目,并发现汇集的结果似乎改变了我为输出中的一个变量所拥有的虚拟代码。

详细地说,假设我有一个因子 ,foo有两个级别:01。使用正则lm通常会产生 的估计值foo1。但是,使用mice和函数会产生 的估计值。我在下面使用包中的数据集包含了一个可重现的示例。任何想法为什么可能会发生?poolfoo2nhanesmice

0 投票
0 回答
300 浏览

r - 在将列添加到估算数据集后在小鼠中运行分析

mice我使用in 对100 个数据集进行了多次估算R,然后使用 mouse 命令将它们汇集在一起compute​​,以便在汇集的数据集上运行一些 oder 操作。此操作的结果是池数据集的附加列。

现在我想在老鼠框架内“回来”,使用with.mids.

如何“分离”我的数据集 + 新列以获取mids要使用的对象with.mids

是否可以mids通过使用 as.mids函数然后使用with mice命令来创建对象?

非常感谢。

伊曼纽拉

0 投票
1 回答
675 浏览

r - 在小鼠 r 包中实现随机森林时出错

这里只是示例数据:

我收到以下错误:

我不确定是什么导致了这个问题?

0 投票
1 回答
8290 浏览

r - 使用mice R包并行计算多重插补

我想通过使用micein运行 150 次多重插补R。但是,为了节省一些计算时间,我会撒谎将过程细分为并行流(正如 Stef van Buuren 在“缺失数据的灵活插补”中所建议的那样)。

我的问题是:如何做到这一点?

我可以想象2个选项:

选项 1:

complete然后通过使用和as.mids之后将插补组合在一起

选项 2:

通过添加VAL_1to150其他方式,在我看来(我可能错了)如果它们都使用相同的数据集和相同的种子运行,那么您将获得 150 倍相同的结果。

还有其他选择吗?

谢谢

0 投票
1 回答
2695 浏览

r - 插补期间使用随机森林(MICE 包)时出错

我想使用随机森林方法来估算缺失值。我读过一些论文,声称 MICE 随机森林比参数小鼠表现更好。

就我而言,我已经为默认鼠标运行了一个模型,并得到了结果并与它们一起玩。然而,当我有一个随机森林方法的选项时,我得到了一个错误,我不知道为什么。我见过一些与随机森林和老鼠错误有关的问题,但这些不是我的情况。我的变量有多个 NA。

任何人都知道为什么我会收到此错误?

编辑

我试图将所有变量更改为数字而不是虚拟变量,它返回了相同的错误和一些警告()

编辑1

我只尝试了 5 次插补和较小的数据子集,只有 2000 行,但出现了一些不同的错误:

0 投票
3 回答
6408 浏览

r - MICE中纵向数据的多重插补和对象类型中间的统计分析

在使用小鼠估算缺失值后,我在对纵向数据进行统计分析时遇到了问题。在对宽数据格式的缺失进行插补后,我将提取的数据转换为长格式。由于纵向数据参与者有重复的行(3 个时间点),这在将长格式数据集转换为类型 mids 对象时会导致问题。有谁知道如何在插补后创建一个 mids 对象或其他合适的东西?之后我想使用 lmer,lme 来合并固定效果。我尝试了很多不同的东西,但仍然无法弄清楚。

在此先感谢并查看以下代码:

最好的,

朱利安

0 投票
1 回答
102 浏览

r - 估算数据的计算值

我想做类似以下的事情:(myData是一个数据表)

我想为每个估算的数据集添加一个计算值,然后使用该计算值进行统计。显然,上面的结构可能不是你会怎么做的。我会对任何解决方案感到满意,无论是在老鼠之前以某种方式准备数据表,在上面勾勒的“fit =”之前的一步,还是在“with”调用中的一些复杂函数。

0 投票
1 回答
2332 浏览

r - Leftover NAs after imputing using mice

What is going on in the following?

The result should be 0, if mice had successfully replaced all the NA values. But it's not. What am I doing wrong?

0 投票
1 回答
548 浏览

r - Number of imputations attribute wrong when using as.mids() from the {mice} package?

I'm relatively new to R and absolutely new to the forum, so I may be unaware of some posting rules (be kind).

The issue i have relates to the as.mids() function in the mice package by Stef van Buuren: when using it the data in the new mids object is fine, but the number of imputations in the attributes is the original + 1.

Example (making use of the original as.mids() example and data in the mice package):

The created object now shows: number of imputations = 6 (instead of 5), somehow also influencing analysis as demonstrated by the difference between

When looking through the code of as.mids() one minor change seems to solve this, but my R knowledge really requires a second opinion.

Original as.mids() code as below:

Now modifying the m parameter in the call for mice in the definition of ini (3 row) seems to solve it (only acounting for the fact that max(as.numeric()) gives the number of levels, thus including the original data, which is probably not ment):

Using as.mids.mod in the example now gives similar analysis results:

Am I doing something wrong in my use of the function and/or problem solving or should the as.mids() function be very slightly modified?

0 投票
1 回答
2292 浏览

r - Has anyone tried to parallelize multiple imputation in 'mice' package?

I'm aware of the fact that Amelia R package provides some support for parallel multiple imputation (MI). However, preliminary analysis of my study's data revealed that the data is not multivariate normal, so, unfortunately, I can't use Amelia. Consequently, I've switched to using mice R package for MI, as this package can perform MI on data that is not multivariate normal.

Since the MI process via mice is very slow (currently I'm using AWS m3.large 2-core instance), I've started wondering whether it's possible to parallelize the procedure to save processing time. Based on my review of mice documentation and the corresponding JSS paper, as well as mice's source code, it appears that currently the package doesn't support parallel operations. This is sad, because IMHO the MICE algorithm is naturally parallel and, thus, its parallel implementation should be relatively easy and it would result in a significant economy in both time and resources.

Question: Has anyone tried to parallelize MI in mice package, either externally (via R parallel facilities), or internally (by modifying the source code) and what are results, if any? Thank you!