Skip to content

Instantly share code, notes, and snippets.

@bfatemi
Created April 4, 2019 01:55
Show Gist options
  • Save bfatemi/39c77015530ac076bd5f07494730ed40 to your computer and use it in GitHub Desktop.
Save bfatemi/39c77015530ac076bd5f07494730ed40 to your computer and use it in GitHub Desktop.
Example of plotting quantile regression in R.
install.packages("quantreg")
pdt <- dt[durProc < 400 &
ExpIndex < 500 &
ExpIndex > 4]
pdt2 <- pdt[, .(aveDur = mean(durProc)), ExpIndex][order(ExpIndex)]
m <- ggplot(pdt2, aes(ExpIndex, aveDur)) +
geom_point() +
scale_y_log10() +
scale_x_log10()
qs <- c(0.15,0.50,0.85)
m + geom_quantile(quantiles = qs, formula=y ~ poly(x, 3)) +
ggtitle("Quantile Regression Model for Average Duration",
"Inguinal Hernia, Xi, All Surgeons")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment