strengejacke / sjPlot

sjPlot - Data Visualization for Statistics in Social Science

Home Page:https://strengejacke.github.io/sjPlot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support for a quantile regression

yuryzablotski opened this issue · comments

Describe the solution you'd like
I would like to be able to plot predictions of quantile regression similarly, like it's currently possible for OLS / GLM. A single quantile would be great, all quantiles at once would be terrific!

It works with only plot_model(model), but doesn't work with plot_model(model, type = "eff", terms = "predictor")

By the way, the emmeans guys (almost, some bugs are still there) made it work with quantile regression and I can use the emmip for plotting. But I prefer your package.

How could we do it?
Should be very similar to OLS with the use of "tau" argument, where tau is the quantile. A list of taus is of couarse a much better choice, a compared to a single tau.

Code example

library(ISLR)
library(quantreg)

lr <- lm(wage ~ jobclass + age, Wage)
qr10 <- rq(wage ~ jobclass + age, Wage, tau = 0.1)
qr50 <- rq(wage ~ jobclass + age, Wage, tau = 0.5)
qr90 <- rq(wage ~ jobclass + age, Wage, tau = 0.9)

qr_all <- rq(wage ~ jobclass + age, Wage,
tau = seq(.05, .95, by = 0.05))

summary(qr_all) %>% plot()