7.Replicate the plot below which describes the relationship between bmi (body mass index) in logarithmic unit and age (between 5 and 13 years) based on a sample of 7,482 Dutch boys from the data set boys7482{AGD}.
pkgs <- c("dplyr", "tidyr", "magrittr", "ggplot2", "AGD" , "quantreg")
lapply(pkgs, require, character.only = TRUE)
[[1]]
[1] TRUE
[[2]]
[1] TRUE
[[3]]
[1] TRUE
[[4]]
[1] TRUE
[[5]]
[1] TRUE
[[6]]
[1] TRUE
dta<-boys7482
qs <- 1:9/10
m0 <- rq(bmi ~ age, data = dta, tau = qs)
#
ggplot(dta, aes(age, log(bmi))) +
geom_point(alpha=.5) +
geom_quantile(quantiles = qs)+
labs(x = "Age", y = "BMI") +
xlim(5,13)+
ylim(2.5,3.3)+
theme_bw()