r - 使用 par(mfrow()) 方法在一个图中拟合两个 coefplot
问题描述
我试图coefplot
通过该方法将两个对象排列成一个图形par(mfrow(,))
,但没有成功。我做错了什么?或者这coefplot
只是行不通?什么是替代方法?我已经引用了这个较早的线程,但我倾向于认为我的问题是一个完全不同的问题。
# load the data
dat <- readRDS(url("https://www.dropbox.com/s/88h7hmiroalx3de/act.rds?dl=1"))
#fit two models
library(lmer4)
act1.fit <- glmer(act1 ~ os + education + marital + nat6 + nat5 + nat4 + nat3 + nat2 + nat1 +
(1 | region_id), data = action, family = binomial, control = glmerControl(optimizer = "bobyqa"),
nAGQ = 10)
action2.fit <- glmer(act2 ~ os + education + marital + nat6 + nat5 + nat4 + nat3 + nat2 + nat1 +
(1 | region_id), data = action, family = binomial, control = glmerControl(optimizer = "bobyqa"),
nAGQ = 10)
# plot the two model individually
library(coefplot)
# construct coefplot objects
coefplot:::buildModelCI(action1.fit)
coefplot:::buildModelCI(action2.fit)
coefplot(action2.fit, coefficients=c("nat1", "nat2", "nat3", "nat4", "nat5", "nat6"),
intercept = FALSE, color = "brown3")
# arrange two plots in one graph
par(mfrow=c(1,2))
coefplot(action1.fit, coefficients=c("nat1", "nat2", "nat3", "nat4", "nat5", "nat6"),
intercept = FALSE, color = "brown3")
coefplot(action2.fit, coefficients=c("nat1", "nat2", "nat3", "nat4", "nat5", "nat6"),
intercept = FALSE, color = "brown3")
# didn't work ???
解决方案
推荐阅读
- kubernetes - 我无法将 kubernetes 集群中的服务暴露给互联网
- sql - 命名查询不接受 % 运算符作为 sql
- c# - 如何在 Ef Core 的通用存储库模式中添加包含?
- r - 使用 knitr 在 Rmarkdown 中居中子标题
- angular - 注销时如何摆脱“错误:permission_denied”?(Angular-Firebase)
- excel - VB 如何在 Excel 单元格中使用逗号?
- python - 从数据库scrapy中检索数据
- javascript - 什么时候需要重新初始化 jQuery 元素
- list - 如何在列列表上应用总和
- google-cloud-platform - 将无效的提取器配置上传到 Airflow 后如何取回我的 DAG?