- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想使用新的 lme4 包(当前的开发者版本)的新 bootMer() 功能。我是 R 的新手,不知道应该为其 FUN 参数编写哪个函数。它说它需要一个数值向量,但我不知道该函数将执行什么。所以我有一个混合模型公式,它被转换为 bootMer(),并且有很多重复。所以我不知道那个外部函数是做什么的?它应该是引导方法的模板吗? bootstrapping 方法不是已经在 bootMer 中实现了吗?那么为什么他们需要一个外部的“感兴趣的统计数据”呢?我应该使用哪个感兴趣的统计数据?
以下语法是否适合使用? R 不断产生错误,即 FUN 必须是数值向量。我不知道如何将估计值与“适合”分开,甚至我应该首先这样做吗?我只能说我对那个“有趣”的论点迷失了。另外我不知道我应该使用变量“Mixed5”传递混合模型 glmer() 公式还是应该传递一些指针和引用?我在示例中看到 X(bootMer() 的第一个参数是 *lmer() 对象。我想编写 *Mixed5 但它呈现错误。
非常感谢。
我的代码是:
library(lme4)
library(boot)
(mixed5 <- glmer(DV ~ (Demo1 +Demo2 +Demo3 +Demo4 +Trt)^2
+ (1 | PatientID) + (0 + Trt | PatientID)
, family=binomial(logit), MixedModelData4))
FUN <- function(formula) {
fit <- glmer(DV ~ (Demo1 +Demo2 +Demo3 +Demo4 +Trt)^2
+ (1 | PatientID) + (0 + Trt | PatientID)
, family=binomial(logit), MixedModelData4)
return(coef(fit))
}
result <- bootMer(mixed5, FUN, nsim = 3, seed = NULL, use.u = FALSE,
type = c("parametric"),
verbose = T, .progress = "none", PBargs = list())
result
FUN
fit
Error in bootMer(mixed5, FUN, nsim = 3, seed = NULL, use.u = FALSE, type = c("parametric"), :
bootMer currently only handles functions that return numeric vectors
library(lme4)
library(boot)
(mixed5 <- glmer(DV ~ (Demo1 +Demo2 +Demo3 +Demo4 +Trt)^2
+ (0 + Trt | PatientID)
, family=binomial(logit), MixedModelData4))
FUN <- function(fit) {
fit <- glmer(DV ~ (Demo1 +Demo2 +Demo3 +Demo4 +Trt)^2
+ (1 | PatientID) + (0 + Trt | PatientID)
, family=binomial(logit), MixedModelData4)
return(fixef(fit))
}
result <- bootMer(mixed5, FUN, nsim = 3)
result
(mixed5 <- glmer(DV ~ Demo1 +Demo2 +Demo3 +Demo4 +Trt
+ (1 | PatientID) + (0 + Trt | PatientID)
, family=binomial(logit), MixedModelData4))
FUN <- function(mixed5) {
return(fixef(mixed5))}
result <- bootMer(mixed5, FUN, nsim = 2)
In bootMer(mixed5, FUN, nsim = 2) : some bootstrap runs failed (2/2)
> result
Call:
bootMer(x = mixed5, FUN = FUN, nsim = 2)
Bootstrap Statistics :
WARNING: All values of t1* are NA
WARNING: All values of t2* are NA
WARNING: All values of t3* are NA
WARNING: All values of t4* are NA
WARNING: All values of t5* are NA
WARNING: All values of t6* are NA
FUN <- function(fit) {
return(fixef(fit))}
result <- bootMer(mixed5, FUN, nsim = 2)
Warning message:
In bootMer(mixed5, FUN, nsim = 2) : some bootstrap runs failed (2/2)
> result
Call:
bootMer(x = mixed5, FUN = FUN, nsim = 2)
Bootstrap Statistics :
WARNING: All values of t1* are NA
WARNING: All values of t2* are NA
WARNING: All values of t3* are NA
WARNING: All values of t4* are NA
WARNING: All values of t5* are NA
WARNING: All values of t6* are NA
最佳答案
这里基本上有两个(简单的)混淆。
coef()
(返回矩阵列表)和 fixef()
(返回固定效应的向量)之间fixef()
是你想要的,尽管你可能想要类似 c(fixef(mixed),unlist(VarCorr(mixed)))
的东西。 FUN
应该将拟合的模型对象作为输入... library(lme4)
library(boot)
mixed <- glmer(incidence/size ~ period + (1|herd),
weights=size, data=cbpp, family=binomial)
FUN <- function(fit) {
return(fixef(fit))
}
result <- bootMer(mixed, FUN, nsim = 3)
result
## Call:
## bootMer(x = mixed, FUN = FUN, nsim = 3)
## Bootstrap Statistics :
## original bias std. error
## t1* -1.398343 -0.20084060 0.09157886
## t2* -0.991925 0.02597136 0.18432336
## t3* -1.128216 -0.03456143 0.05967291
## t4* -1.579745 -0.08249495 0.38272580
##
关于R:使用新 lme4 包的 bootMer() 引导二进制混合模型逻辑回归,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18443127/
我正在尝试使用中介包在 R 中进行中介分析。我查看了有关如何执行此操作的文档,并通读了 R 提供的示例(即,我已经运行了“example(mediate)”)。尽管如此,我还是无法运行最简单的中介。理
我在我的应用程序中引导 View 时遇到问题。 我试图在 bootstrap 中获取 View 实例,以便我可以分配 View 变量等。 问题是我似乎无法按照推荐的方式来做。我可以做这个: $this
我已经遵循了几个有关运行 RMI 应用程序的教程。但是,我似乎无法使其工作,因为我一直陷入相同的错误:ClassNotFoundException。我知道这个错误意味着我将文件放在了错误的位置,但我尝
最后,我开始与 Aurelia 合作。有一个入门套件可用 Here这有助于初始化 Aurelia。但它是一个模板,应该在网站模板中使用。 我有一个预配置 WebApi项目,我想在其中使用 Aureli
对于回归问题,我有一个训练数据集: - 3个具有高斯分布的变量 - 20 个均匀分布的变量。 我的所有变量都是连续的,在 [0;1] 之间。 问题是用于对我的回归模型进行评分的测试数据对所有变量具有均
我正在尝试“拉伸(stretch)”或扩展第 1 列中的 A 部分以填充该行的高度。 1行2列: +---------------------+---------------------+ |
已关闭。此问题旨在寻求有关书籍、工具、软件库等的建议。不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以
我正在使用 bootstrap 4 填充功能。默认情况下,bootstrap4 中的 col 或 col-12 类在左右应用 15px 填充。我想为移动设备设置左右padding 0,所以我使用下面的
我正在尝试通过自己编写引导加载程序来引导 linux 内核,但不知道如何加载内核。 所有人都在说使用 int 13h 将扇区从硬盘加载到内存。 其中部门应该加载??加载扇区后怎么办? 如果可以的话,请
如何合并两者以创建垂直菜单?我有一个基本的路由设置(它可以工作并呈现为标准的水平菜单): Home Gallery Contact 从 react-bootst
我的应用程序中有一些状态来自服务器并且不会更改(在用户 session 的生命周期内)。此状态在 HTML 中引导。 我应该将它合并到 reducer 中作为商店的一部分吗?const bootstr
有没有办法使用 styled-components与 react-bootstrap 一起? React-bootstrap 为其组件公开了 bsClass 属性而不是 className ,这似乎与
除了 YouTube 播放器的大小之外,以下代码运行良好。我无法将其调整为我想要的大小。 我试着把 width="150"和 height="100"在 iframe 但什么也没发生。
我正在尝试使这个东西与 this one 相同。我已经打印了。但崩溃消耗不起作用。 @foreach($faqs as $faq)
我想在启动 Play 应用程序时运行一些代码。这似乎不起作用。有什么线索吗? public class Global extends GlobalSettings { @Override
我了解监督学习和无监督学习之间的区别: 监督学习是一种使用标记数据“教导”分类器的方法。 无监督学习让分类器“自行学习”,例如使用聚类。 但是什么是“弱监督学习”?它如何对示例进行分类? 最佳答案 更
我对 python 还是很陌生,所以请原谅我,如果这是非常简单的或非常错误的思考方式。 我安装了 python 2.7。根据我在运行以下代码时的理解,它列出了它查找模块的目录。 Python 2.7.
我想使用 bootstrap carousel 制作一个 slider ,但我的 slider 不滑动即使我点击按钮也不会滑动 我测试了很多其他的 bootstrap slider ,我也遇到了同样的
我正在尝试通过替换 base 形状为 (4,2) 的 2D numpy 数组按行进行采样,比如 10 次。最终输出应该是一个 3D numpy 数组。 尝试了下面的代码,它有效。但是有没有不用 for
我是 Bootstrap 的新手,现在我正在检查它的 slider 功能。简单的 slider 和动画效果 - 一切正常。 但是我看不懂,我可以做这样的东西吗? - http://www.owlcar
我是一名优秀的程序员,十分优秀!