cqrMMcpp: 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. The point of interest can be either interior or boundary.

Usage

1
cqrMMcpp(x0, x_vec, y, 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.

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. Defaults to 100.

tol

Convergence criterion in the MM algorithm. Defaults to 1e-4.

Value

cqrMMcpp 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
# 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 = cqrMMcpp(x0     = 0,
               x_vec  = data_n$poverty,
               y      = data_n$mortality,
               kernID = 2,
               tau    = tau,
               h      = 4.0,
               p      = 1,
               maxit  = 100,
               tol    = 1.0e-4)
               
# 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.