library("quantreg")
在普通分位数回归中,qr
我们可以通过 option 指定自定义分位数tau
。
rq(y ~ x, tau=c(.1, .5, .9))
# Call:
# rq(formula = y ~ x, tau=c(0.1, 0.5, 0.9))
#
# Coefficients:
# tau= 0.1 tau= 0.5 tau= 0.9
# (Intercept) 3.853102 5.0167138 6.114065
# x 1.001021 0.9788141 1.057501
#
# Degrees of freedom: 200 total; 198 residual
在审查分位数回归中crq
,帮助页面声称我们也可以通过 option 指定自定义分位数taus
,但这似乎没有任何效果。
crq(survival::Surv(pmax(y,c), d, type="left") ~ x, taus=c(.1, .5, .9),
method="Portnoy")
# Call:
# crq(formula = survival::Surv(pmax(y, c), d, type = "left") ~
# x, taus = c(0.1, 0.5, 0.9), method = "Portnoy")
#
# Coefficients:
# tau= 0.2 tau= 0.4 tau= 0.6 tau= 0.8
# (Intercept) 4.372369 4.759209 5.2595952 5.802093
# x 1.003349 1.023991 0.9801221 1.133222
有人知道如何指定自定义分位数crq
吗?
数据
# crq example with left censoring
set.seed(1968)
n <- 200
x <-rnorm(n)
y <- 5 + x + rnorm(n)
c <- 4 + x + rnorm(n)
d <- (y > c)