Description Usage Arguments Details Value Author(s) Examples
get the observation used in br algorithem
1 | frame_br(object, tau)
|
object |
quantile regression model using br method |
tau |
quantiles can be a single quantile or a vector of quantiles |
This is a function that can be used to create point plot for the observations used in quantile regression fitting based on 'br'method.
All observations and the observations used in quantile regression fitting using br algorithem
Wenjing Wang wenjingwangr@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | library(ggplot2)
library(quantreg)
data(ais)
tau <- c(0.1, 0.5, 0.9)
object1 <- rq(BMI ~ LBM, tau, method = 'br', data = ais)
data_plot <- frame_br(object1, tau)$all_observation
choose <- frame_br(object1, tau)$fitting_point
ggplot(data_plot,
aes(x=value, y=data_plot[,2])) +
geom_point(alpha = 0.1) +
ylab('y') +
xlab('x') +
facet_wrap(~variable, scales = "free_x", ncol = 2) +
geom_point(data = choose, aes(x = x, y = y,
group = tau_flag,
colour = tau_flag,
shape = obs))
object2 <- rq(BMI ~ Ht + LBM + Wt, tau, method = 'br',
data = ais)
data_plot <- frame_br(object2, tau)$all_observation
choose <- frame_br(object2, tau)$fitting_point
ggplot(data_plot,
aes(x=value, y=data_plot[,2])) +
geom_point(alpha = 0.1) +
ylab('y') +
xlab('x') +
facet_wrap(~variable, scales = "free_x", ncol = 2) +
geom_point(data = choose, aes(x = x, y = y,
group = tau_flag,
colour = tau_flag,
shape = obs))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.