0

I am making an analysis of covariance using quantiles and I would like to plot using ggplot2 quantile lines by group but changing the style if they are significant at some level e.g. p<0.1

library(quantreg)
library(ggplot2)
data(barro)
barro$group=factor(round(runif(nrow(barro),1,3)))

fit0 <- rq(y.net ~  lgdp2 * group , data = barro,tau=c(.25, .5, .75))
sf <-summary(fit0,se="boot")

#extract coefficients
as.data.frame(lapply(sf, coef))

ggplot(barro,aes(lgdp2,y.net)) +facet_wrap( ~ group)+ geom_point(aes(colour=group)) +  theme_bw() + stat_quantile() 

enter image description here

In this plot all lines have the same style and I don't figure out how to change the style of the quantile lines, to know which of them are significative at the specified p level.

lmo
  • 37,904
  • 9
  • 56
  • 69
Leosar
  • 2,010
  • 4
  • 21
  • 32
  • What do you mean when you are calling a line "significant". That term generally refers to a parameter value comparison to a null value. (So I think you need to improve your understanding of statistical fundamentals before proceeding.) – IRTFM Nov 25 '15 at 16:50
  • Is this helpful `ggplot(barro, aes(lgdp2, y.net)) + geom_point(aes(colour=group)) + facet_wrap( ~ group) + theme_bw() + stat_quantile() + stat_quantile(quantiles = 0.1, colour = "red")`? – Eric Fail Nov 25 '15 at 16:52
  • @42 yes the null is that slopes are 0 and p-values are in the coefficients table like "Pr...t..." which means Pr(>|t|) – Leosar Nov 25 '15 at 17:07
  • @EricFail that's a start but the quantiles=0.1 for all the groups are red, I want only the significant ones. – Leosar Nov 25 '15 at 17:09

0 Answers0