ptm <- proc.time()
set.seed(123)
n <- 500
tau <- 0.5
bet0 <- c(1,1,1,-3,4,4)
psi0 <- c(-3,0,3)
k <- length(psi0)
x <- runif(n, -5, 5)
z <- rnorm(n, 1, 1)
X <- matrix(rep(x,k),nrow=n)
PSI <- matrix(rep(psi0,rep(n,k)),ncol=k)
XZ <- cbind(1,z,x,pmax((X-PSI),0))
e <- rnorm(n,0,1) - qnorm(tau, 0,1)
y <- as.vector(XZ %*% bet0) + e
fit <- mkqr.fit(y,x,z,psi=NULL,k=3,tau)
proc.time() - ptm
Run the code above in your browser using DataLab