抑制 plot(allEffects(model)) 输出中的一些图 [英] suppressing some of the plots from plot(allEffects(model)) output

查看:84
本文介绍了抑制 plot(allEffects(model)) 输出中的一些图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这是否可行,但我想知道您是否可以从 plot(allEffects(model)) 输出中删除一些不那么有趣的图.我认为这可以通过编辑 R 用于制作图形数组的一些背景机制来实现.我已经使用多线将图的数量从 20 个减少了,但我只对剩余的 10 个图中的 2 个感兴趣,因为它最准确地代表了我的模型(广义线性混合模型)的交互效应之一.

I'm not sure this is possible, but I'm wondering if you can remove some of the not-as-interesting plots from the plot(allEffects(model)) output. I assume this is possible by editing some of the background mechanics that R uses to make the array of graphs. I've already used multiline to reduce the number of graphs from 20, but I'm only interested in 2 of 10 of my remaining plots because it most accurately represents one of my interaction effects from my model (generalized linear mixed model).

示例代码:

glmer1 <- glmer(dv ~ categoricalv1*dimensionalv1*categoricalv2*dimensionalv2 + (1 | subjectID), data = data1, family = binomial, contrasts=contrasts1, control = glmerControl(optimizer = "bobyqa"))

当我查看所有效果函数中的值时:

When I view the values within the all effects function:

allEffects(model)
model: dv ~ categoricalv1 * dimensionalv2 * categoricalv2 * dimensionalv2

R 显然正在从输出中读取值以生成 10 个图形:

R is clearly reading the values from the output to produce 10 graphs:

例如:

catv1*dimv1*catv2*dimv2 effect, , catv2 = 0, dimv2 = -4 ... 
           dimv1
catv1             -2      -0.7       0.5         2         3
dv level1        0.269329 0.4296272 0.5929832 0.7686877 0.8520351
dv level2        0.730671 0.5703728 0.4070168 0.2313123 0.1479649
... (x9 more times to show all the different combinations)

情节代码(到目前为止):

Code for the plot (so far):

 plot(allEffects(model), ylab="Proportion", xlab="Standardized Dimensional V1", main="",
 type="rescale", multiline=T, rescale.axis=F, ci.style="band")

希望有一种方法可以编辑某些内容以仅显示我感兴趣的情节.任何见解将不胜感激:)

Hopefully there is a way to edit something to only show the plot I'm interested in. Any insights would be appreciated :)

推荐答案

使用函数 selection=2,

plot(allEffects(model), ylab="Proportion", **selection=2**, xlab="Standardized Dimensional V1", main="", type="rescale", multiline=T, rescale.axis=F, ci.style="band")

for example;

model2<-plot(allEffects(model), selection=2)

model6<-plot(allEffects(model), selection=6)

如果你想组合不同的图,你可以使用

if you want to combine different plots you can use

library(gridExtra)

grid.arrange( model2, model6,  nrow=1,  ncol=2)

这篇关于抑制 plot(allEffects(model)) 输出中的一些图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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