[R] censored quantile regression
Ashley Isaac Naimi, Mr
ashley.naimi at mcgill.ca
Tue Jan 20 16:51:44 CET 2015
Hi there,
I've generated the following data:
library(quantreg)
library(survival)
set.seed(789)
N <- 2000
u <- runif(N)
x1 <- rbinom(N,1,.5)
x2 <- rbinom(N,1,.5)
x1x2<-x1*x2
lambda <- 1 + 1.5*x1 + 1.5*x2 + .5*x1x2
k <- 2
y <- lambda*((-log(1-u))^(1/k));max(y)
c <- runif(N,max=15)
event = as.numeric(y<=c)
mean(event);table(event)
cens <- 1-event
table(cens);mean(cens)
time <-as.matrix(ifelse(event==1,y,c))
St<-Surv(time,event,type="right")
To which I've fit the following censored quantile regression model:
q2 <- crq(St~x1 + x2 + x1x2,tau=.9,method="Portnoy")
summary(q2)
As one can see, I'm interested in the 0.9th quantile. But summary(q2) returns only the 20th to 80th percentiles (by 20). How can I get only the 0.9th quantile (aka the 90th percentile)?? All I actually need is the parameter estimate for the interaction (x1x2) for the 90th percentile. I know how to extract it if I were able to obtain estimates at tau=0.9, but no luck. Even though I request the 90th percentile in crq (i.e., "tau=0.9"), the summary function keeps returning the same set of (unwanted) percentiles (20th, 40th, 60th, 80th).
I’m using R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet”, Platform: x86_64-apple-darwin13.4.0 (64-bit).
Cheers,
Ashley I Naimi
[[alternative HTML version deleted]]
More information about the R-help
mailing list