Package install and data plot
library(quantreg)
## Loading required package: SparseM
##
## Attaching package: 'SparseM'
##
## 以下のオブジェクトはマスクされています (from 'package:base') :
##
## backsolve
data(engel)
plot(engel)
Quantile Regression with 25-Percentile.
rq(foodexp ~ income, data = engel, tau = seq(0, 1, 0.25))
## Call:
## rq(formula = foodexp ~ income, tau = seq(0, 1, 0.25), data = engel)
##
## Coefficients:
## tau= 0.00 tau= 0.25 tau= 0.50 tau= 0.75 tau= 1.00
## (Intercept) 113.1406 95.4835 81.4822 62.397 225.3825
## income 0.2942 0.4741 0.5602 0.644 0.6403
##
## Degrees of freedom: 235 total; 233 residual
Japanese Baseball player's data from http://baseball-data.com/
baseX <- read.csv("base_bat.csv")
lm.last <- lm(money ~ HR + daritu + K, data = baseX)
rq(lm.last, tau = seq(0, 1, 0.2))
## Call:
## rq(formula = lm.last, tau = seq(0, 1, 0.2))
##
## Coefficients:
## tau= 0.0 tau= 0.2 tau= 0.4 tau= 0.6 tau= 0.8 tau= 1.0
## (Intercept) 6397.824 4240.72 19254.12 26939.60 43763.4 49771.6
## HR 23.106 315.67 362.49 415.01 873.7 1287.0
## daritu 9216.891 28992.55 -23872.98 -38356.99 -81446.0 -68926.8
## K -1.499 -62.67 -33.99 -43.16 -125.8 -229.7
##
## Degrees of freedom: 52 total; 48 residual