user6121484 user6121484 - 10 months ago 47
R Question

sjPlot for robust regression?

Is there someone who know if sjp.Int works for robust regressions? Basic plotting works, but the confidence intervals do not work?

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

Command I used was:

fname = rlm(Y ~ X1+X2+X3+X4*X5, data=mydata), type="eff",

For type="cond", the confidence intervals do work


I think it is impossible."eff") uses effects::allEffects() to calculate CI etc. But this function doesn't calculate rlm.model's CI (returns NAs), so, type="eff", doesn't work. (Reference code; summary(effects::allEffects(fname, KR=F))).


(, type="eff")) returns data.list and it have information about se. But I don't think the value is credible. If you want to draw a graph like, I think it would be better for you to use predict(rlm.model) because predict have a method of treating rlm.model.

my example;


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