R的coefplot中的系数递减? [英] decreasing coefficients in R's coefplot?
本文介绍了R的coefplot中的系数递减?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
coefplot
具有变量decreasing
,将其设置为TRUE
时,系数应按降序排列
coefplot
from library(coefplot)
has a variable decreasing
which when set to to TRUE
the coefficients should be plotted in descending order
但是当我运行一个玩具示例时:
But when I run a toy example:
data(tips, package = "reshape2")
mod1 <- lm(tip ~ day + sex + smoker, data = tips)
coefplot.glm(mod2, decreasing = TRUE)
系数不是降序排列的.
the coefficients aren't in descending order.
我想念什么?
编辑,我错过了sort = "magnitude"
.但是,这不适用于multiplot
:
EDIT I was missing sort = "magnitude"
. However, this doesn't work with multiplot
:
data(tips, package = "reshape2")
mod1 <- lm(tip ~ day + sex + smoker, data = tips)
mod2 <- lm(tip ~ day + sex + smoker + size, data = tips)
multiplot(mod1, mod2, decreasing = TRUE, sort = "magnitude")
推荐答案
您需要设置sort = "magnitude"
:
coefplot(mod1, decreasing = TRUE, sort = "magnitude")
默认排序为自然",实际上是1:length(coef(mod1))
.
The default sorting is "natural", which is effectively 1:length(coef(mod1))
.
这篇关于R的coefplot中的系数递减?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文