So I am trying to calculate quantile regression and plot result in ggplot
for some reason dummy variables cannot be shown for some reason when plotting result in ggplot
Code on example mtcars
dataset if as folows:
library(dplyr)
library(ggplot2)
library(qre)
library(quantreg)
library(fastDummies)
dataset <- mtcars
dataset <- dummy_cols(dataset, select_columns = "gear")
dataset
rq(data=dataset,
tau= 1:9/10,
formula = hp ~ disp + mpg + qsec + gear_4 + gear_5) %>%
broom::tidy() %>%
#filter(term!="(Intercept)") %>%
ggplot(aes(x=tau,y=estimate))+
geom_point(color="#27408b", size = 3)+
geom_ribbon(aes(ymin=conf.low,ymax=conf.high),alpha=0.25, fill="#27408b")+
geom_line(color="#27408b", size = 1)+
geom_smooth(method= "lm", colour = "red", se = T)+
my_theme +
facet_wrap(~term,scales="free",ncol=2)
QR.2 <- rq(hp ~ disp + mpg + qsec + gear_4 + gear_5, data = dataset, tau = 1:9/10)
plot(summary(QR.2, se = "boot"))
When plotting result using plot(summary(QR.2, se = "boot"))
everything work just fine, but for some reason using ggplot shows a mistake.