qrs.fast {fastqrs} | R Documentation |
qrs.fast
Description
Estimation of Quantile Regression with Selection (QRS) using Algorithm 3 for the estimation of the quantile and copula coefficients.
Usage
qrs.fast(y, x, d, z, w = NULL, Q1, Q2, P = 10, link, family, gridtheta, m = 1)
Arguments
y |
= Dependent variable (N x 1) |
x |
= Regressors matrix (N x K) |
d |
= Participation variable (N x 1) |
z |
= Regressors and instruments matrix for the propensity score (N x Kz) |
w |
= Sample weights (N x 1) |
Q1 |
= Number of quantiles in reduced grid |
Q2 |
= Number of quantiles in large grid |
P |
= Number of evaluated values of parameter with large quantile grid |
link |
= Link function to compute the propensity score |
family |
= Parametric copula family |
gridtheta |
= Grid of values for copula parameter (T x 1) |
m |
= Parameter to select interval of observations in top and bottom groups |
Value
gamma = Estimated gamma coefficients (Kz x 1)
beta = Estimated beta coefficients (K x Q2)
theta = Estimated copula parameter
objf = Value of objective function at the optimum
b1 = Estimated beta coefficients for the grid of values of the copula parameter with the reduced quantile grid (K x Q1 x T)
Examples
set.seed(1)
N <- 100
x <- cbind(1, 2 + runif(N))
z <- cbind(x, runif(N))
cop <- copula::normalCopula(param = -0.5, dim = 2)
copu <- copula::rCopula(N, cop)
v <- copu[,1]
u <- copu[,2]
gamma <- c(-1.5, 0.05, 2)
beta <- cbind(qnorm(u), u^0.5)
prop <- exp(z %*% gamma) / (1 + exp(z %*% gamma))
d <- as.numeric(v <= prop)
y <- d * rowSums(x * beta)
w <- matrix(1, nrow = N, ncol = 1)
Q1 <- 9
Q2 <- 19
P <- 2
m <- 1
gridtheta <- seq(from = -1, to = 0, by = .1)
link <- "probit"
family <- "Gaussian"
result <- qrs.fast(y, x[,-1], d, z[,-1], w, Q1, Q2, P, link, family, gridtheta, m)
summary(result)