search for: joint_thresh_2

Displaying 1 result from an estimated 1 matches for "joint_thresh_2".

Did you mean: joint_thresh
2012 Jul 17
1
Threshold Quantile Regression code CRASHES in R
...qs[r] d <- (q<=qhat) x1 <- x*(d%*%matrix(1,1,k)) x2 <- x*((1-d)%*%matrix(1,1,k)) beta1 <- rq(y~x1,tau)$coefficients[2] beta2 <- rq(y~x2,tau)$coefficients[2] yhat <- x1%*%beta1+x2%*%beta2 list(yhat=yhat,qhat=qhat) }#Threshold Estimation with two independent variables + constant. joint_thresh_2 <- function(y,x,q){ n <- nrow(y) k <- ncol(x) e=y-x[,1]%*%t(rq(y~x-1,tau)$coefficients[3])-x[,2]%*%t(rq(y~x-1,tau)$coefficients[2])-x[,3]%*%t(rq(y~x-1,tau)$coefficients[3]) s0 <- det(t(e)%*%e) n1 <- round(.05*n)+k n2 <- round(.95*n)-k qs <- sort(q) qs <- qs[n1:n2] qs &lt...