sjPlot用于鲁棒回归?

3

请问有人知道sjp.Int是否适用于鲁棒回归?基本绘图可以,但置信区间不起作用。 错误=

Error in seq.default(from = best$lmin, to = best$lmax, by = best$lstep) : 
 'from' must be of length 1
 In addition: Warning messages:
  1: In min(intdf$conf.low, na.rm = T) :
  no non-missing arguments to min; returning Inf
  2: In max(intdf$conf.high, na.rm = T) :
  no non-missing arguments to max; returning -Inf

我使用的命令是:

fname = rlm(Y ~ X1+X2+X3+X4*X5, data=mydata)
sjp.int(fname, type="eff", show.ci=TRUE)

对于type="cond",置信区间确实有效。
1个回答

1
我认为这是不可能的。sjp.int(type="eff")使用effects::allEffects()来计算CI等。但是,这个函数不会计算rlm.model的CI(返回NAs),所以sjp.int(rlm.model, type="eff", show.ci=TRUE)无法工作。(参考代码:summary(effects::allEffects(fname, KR=F)))。 (sjp.int(fname, type="eff"))返回data.list,并且其中包含关于se的信息。但我认为这个值不可信。如果您想绘制像sjp.int这样的图形,我认为最好使用predict(rlm.model),因为predict具有处理rlm.model的方法。
我的例子:
library(ggplot2)

df <- with(iris, data.frame(Y = Petal.Length,     # example data
                            X1 = Sepal.Length, X2 = Sepal.Width, X3 = Petal.Width))

fname <- rlm(Y ~ X1 + X2 * X3, df)
pred.df <- with(df, data.frame(X1 = mean(X1),
                               X2 = c( min(X2), max(X2) ),
                               X3 = rep( seq( min(X3), max(X3), 0.1), each=2 )))

pred.df <- cbind(pred.df, predict(fname, pred.df, interval="confidence"))
pred.df$X2 <- as.factor(pred.df$X2)

ggplot(pred.df, aes(x=X3, y=fit, group=X2, colour=X2, fill=X2)) + geom_line() + 
  geom_ribbon(aes(ymin = lwr, ymax = upr, colour=NULL), alpha=0.2)

enter image description here


我已经检查并比较了predict.rlm()effects::allEffects()的结果,你提到的effects包返回的标准误差与预测函数确实略有不同。预测函数的置信区间不是来自effects包的标准误差的1.96倍,而是约为1.79倍...(因此,rlm估计的标准误差应该与effects包返回的略有不同)。 - Daniel

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接