带有库“效果"的GLMM图中的缩放轴被缩放. [英] Scaling axis in a GLMM plot with library "effects"
问题描述
我是一名生物学专业的毕业生,试图使用R和库"effects"绘制我的GLMM.
I'm a biology graduate trying to plot my GLMM using R and the library "effects".
我正在尝试使用此字符串绘制模型,并且效果很好.
I'm trying to plot my model using this string, and it works perfectly.
library(effects)
mod.cowles <- glmer((preshunt)~road+(1|area),family=binomial)
eff.cowles <- allEffects(mod.cowles)
plot(eff.cowles, main= FALSE,rug=FALSE,colors=1, band.colors=3, col=1)
我的问题是我需要从0到0.5的值以及相同的缩放比例的相同轴心的轴.我正在尝试通过将其添加到脚本中来实现这一目标
My problem is that I need the axis with the same lims, starting from 0 to 0.5 values and with the same scaling. I'm trying to do that by adding them to the script
mod.cowles <- glmer((preshunt)~road+(1|area),family=binomial)
eff.cowles <- allEffects(mod.cowles)
plot(eff.cowles, main= FALSE,rug=FALSE,colors=1, band.colors=3, col=1, xlim=c(0,0.5), ylim=c(0,0.5))
但是随后R只是决定给我一个空图,甚至没有正确的轴.
But then R just decides to give me an empty graph, not even with the correct axis.
有人可以给我提示如何解决这个问题吗?
Can anybody give me a hint on how to solve this problem?
推荐答案
我写信给函数John Fox的作者,得到一个答复,y上的值实际上是对数刻度(:facepalm :,这是逻辑回归!).将原始"值转换为logit并返回是相当简单的.
I wrote to the author of the function John Fox and got a reply that the values on y are actually on logit scale (:facepalm:, it's a logistic regression!). It's fairly trivial to convert "raw" values to logit and back.
这是一个可复制的示例:
Here's a reproducible example:
library(effects)
library(lme4)
mod.cowles <- glmer(volunteer ~ extraversion + (1|sex),
family=binomial, data = Cowles) # doesn't converge
eff.cowles <- allEffects(mod.cowles)
plot(eff.cowles, main= FALSE,rug=FALSE,colors=1, band.colors=3, col=1,
xlim=c(0, 20), ylim = qlogis(c(0.1, 0.6))) # also log(c(.1, .6)/c(.6, .1))
您可以设置 ylim = qlogis(c(0.01,0.99))
,您将获得以下图表.请注意,这是对数刻度,其中0和1是(-)Inf
.
You can set ylim = qlogis(c(0.01, 0.99))
and you'll get the below plot. Mind that this is on logit scale where 0 and 1 are (-)Inf
.
qlogis(seq(0, 1, by = 0.1))
[1] -Inf -2.1972246 -1.3862944 -0.8472979 -0.4054651 0.0000000
0.4054651 0.8472979 1.3862944 2.1972246 Inf
这篇关于带有库“效果"的GLMM图中的缩放轴被缩放.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!