Search code examples
rplotquantreg

How can I add name of xlab and ylab for each variable in Quantile regression plot?


I wrote this code for find the quantile regression plot with X-axis labels and Y-axis labels. But it only gives the plot without axis labels. How can I find the plot with axis labels for each variable.This is the quantile regression plot which gives no axis labels but gives main labels

library(quantreg)

quantile <- c(0.10, 0.20, 0.45, 0.70, 0.90)

fitqr <- rq(logbmi ~ age + total_children_born + education + 
              wealth + Residence + Region + Husband_educ + cur_work, 
            data=dat, tau=quantile , method="fn")
plot(summary(fitqr), lwd=1, pch=20 , cex=1.5, xlab="quantile", 
     ylab="coefficient")

Solution

  • You probably need to enlarge the margins with the mar option, e.g. mar=c(5.1, 4.1, 2.1, 2.1).

    Example

    plot(summary(rq(Sepal.Length ~ Petal.Length + Petal.Width + 
                      Species, tau=quantile, method="fn", data=iris)),
         xlab="tau", ylab="coefficient", mar=c(5.1, 4.1, 2.1, 2.1))
    

    enter image description here