cqrMMxcv: Function to compute the local composite quantile regression...

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

This function computes the local composite quantile regression estimate with covariates. The point of interest can be either interior or boundary.

Usage

1
cqrMMxcv(x0, x_vec, y, xcv, kernID, tau, h, p, maxit = 100L, tol = 1e-04)

Arguments

x0

point of interest

x_vec

a vector of covariates

y

a vector of dependent variable, the treatment outcome variable in the case of regression discontinuity.

xcv

A matrix of additional covariates to be used in local regression analysis. It must have the same number of rows as the running variable x. When calling the function cqrMMxcv directly, if there is no additional covariate, set xcv as an arbitrary zero matrix, e.g., xcv = matrix(0,2,2), as the corresponding function argument value.

kernID

kernel ID for different kernels.

  1. kernID = 0: triangular kernel.

  2. kernID = 1: biweight kernel.

  3. kernID = 2: Epanechnikov kernel.

  4. kernID = 3: Gaussian kernel.

  5. kernID = 4: tricube kernel.

  6. kernID = 5: triweight kernel.

  7. kernID = 6: uniform kernel.

tau

A vector of quantile positions. They are obtained by tau = (1:q)/(q+1).

h

A scalar bandwidth.

p

The polynomial degree.

maxit

Maximum iteration number in the MM algorithm for quantile estimation.

tol

Convergence criterion in the MM algorithm.

Value

cqrMMxcv returns a list with the following components:

beta0

A q by 1 vector of estimates for q quantiles.

beta1

A p by 1 vector of estimates for the first p derivatives of the conditional mean function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Use the Head Start data as an example.
data(headstart)
data_n = subset(headstart, headstart$poverty < 0)
q      = 5
tau    = (1:q) / (q + 1)

# Compute the local composite quantile estimate
est = cqrMMxcv(x0     = 0,
               x_vec  = data_n$poverty,
               y      = data_n$mortality,
               xcv    = matrix(0,2,2),
               kernID = 2,
               tau    = tau,
               h      = 4.0,
               p      = 1,
               maxit  = 10,
               tol    = 1.0e-3)
               
# Estimate of the conditional mean on the boundary
est_mean = mean(est$beta0)

# Estimate of the first derivative of the conditional mean function
est_d1   = est$beta1[1]

xhuang20/rdcqr documentation built on July 1, 2021, 5:22 a.m.