Displaying 1 result from an estimated 1 matches for "stqr_thresh_loop".
2012 Jul 17
1
Threshold Quantile Regression code CRASHES in R
...$coefficients[1]
beta2 <- rq(y~x2-1,tau)$coefficients[3]
c1 <- rq(y~x1-1,tau)$coefficients[2]
c2 <- rq(y~x2-1,tau)$coefficients[2]
yhat <- x1[,1]%*%t(beta1)+x2[,3]%*%t(beta2)+c1+c2
list(yhat=yhat,qhat=qhat)
}#Threshold Reduced-form eqn. Good results for qhat,rhohat BUT crashes!!
tau=0.50stqr_thresh_loop <- function(n,reps,reduced){
qhat=as.vector(reps)
rhohat=as.vector(reps)
kx <- 1
sig <- matrix(c(1,0.5,0.5,1),2,2)
x<- matrix(rnorm(n*kx),n,kx)
q <- matrix(rnorm(n),n,1)
z2 <- cbind(matrix(1,n,1),q)
for(i in 1:reps){
e <- matrix(rnorm(n*2,quantile(rnorm(n),tau),1),n,2)%*%ch...