mkqr.bea {MultiKink}R Documentation

Fit the multi-kink quantile regression in the absence of the number of change points.

Description

Fit the multi-kink quantile regression in the absence of the number of change points.

Usage

mkqr.bea(
  y,
  thre.x,
  cont.z,
  id,
  tau = 0.5,
  Cn = 1,
  bandwidth_type = "Hall-Sheather",
  control = fit.control(),
  est.type = "WI",
  wi.type = "general",
  wc.type = "cs"
)

Arguments

y

A numeric vector of response.

thre.x

A numeric vector of scalar covariate with threshold effect.

cont.z

A numeric matrix of design with constant slopes.

id

A numeric vector of index used for longitudinal data; can be missing or NULL for iid data.

tau

The quantile level that belongs to (0,1). Default is 0.5.

Cn

A positive number corresponding to different types of BIC. Default is 1.

bandwidth_type

The bandwidth type. Specify one from "Hall-Sheather", "Bofinger", and "Chamberlain". Default is "Hall-Sheather".

control

A list returned by fit.control.

est.type

The estimation type for the longitudinal data. Specify one from "WI", "WC", corresponding to the working independence (WI) estimator and working correlation (WC) estimator. Default is "WI".

wi.type

If est.type = "WI", then set the error structure of the variance-covariance matrix estimation. Specify one from "Compound", "AR", and "general".

wc.type

If est.type = "WC", then set the correlation structure within subject. Specify one from "ar" and "cs". Default is "cs".

Value

A list containing the estimated number of kink points (n.psi), the fitted quantile objective value (rho), estimated regression coefficients with intercept (bet.est), the estimated standard error of the regression coefficients (bet.se), the estimated change points (psi.est), and the estimated standard errors of threshold parameters (psi.se).

Examples

## Not run: 
# Simple examples for iid data type
n <- 500
Z1 <- rexp(n,1)
Z2 <- rbinom(n,1,0.5)
Z <- cbind(Z1,Z2)
epsilon <- rnorm(n,0,1)
X <- runif(n,-2,1)
psi <- c(-1,0)
k <- length(psi)
PSI <- matrix(rep(psi,rep(n,k)),ncol=k)
XP <- matrix(rep(X,k),nrow=n)
XR <- cbind(1,X,pmax((XP-PSI),0),Z)
bet <- c(1,-1,3,-3,sqrt(3),-sqrt(3))
Y <- XR %*% bet + epsilon

# Estimation setting
tau <- 0.5
K.max <- 5
control <- fit.control(K.max = K.max)
Cn <- 1
mkqr.bea(y = Y, thre.x = X, cont.z = Z, tau = tau, Cn = Cn, control = control)

# Simple examples for longitudinal data
N <- 200
T <- 5
subject <- rep(1:N, each = T)
NT <- N * T
Z1 <- rexp(NT, 1)
Z2 <- rbinom(NT, 1, 0.5)
Z <- cbind(Z1, Z2)
epsilon <- rnorm(NT, 0, 1)
X <- runif(NT, -2, 1)
psi <- c(-1, 0)
k <- length(psi)
PSI <- matrix(rep(psi, rep(NT, k)), ncol = k)
a <- rnorm(N, 0, 1)
A <- rep(a, each = T)
XP <- matrix(rep(X, k), nrow = NT)
XR <- cbind(1, X, pmax((XP - PSI), 0), Z)
bet <- c(1, -1, 3, -3, sqrt(3), -sqrt(3))
Y <- XR %*% bet + A + epsilon
tau <- 0.5
k <- 2

# Example 1: the working independence estimator; the error structure is "general"
est.type <- "WI"
wi.type <- "Compound"
tau <- 0.5
K.max <- 5
control <- fit.control(K.max = K.max)
Cn <- 1
mkqr.bea(y = Y, thre.x = X, cont.z = Z, id = subject, tau = tau, Cn = Cn,
         control = control, est.type = est.type, wi.type = wi.type)

# Example 2: the working correlated estimator; the correlation structure is "cs"
est.type <- "WC"
wc.type <- "cs"
tau <- 0.5
K.max <- 5
control <- fit.control(K.max = K.max)
Cn <- 1
mkqr.bea(y = Y, thre.x = X, cont.z = Z, id = subject, tau = tau, Cn = Cn,
         control = control, est.type = est.type, wc.type = wc.type)

## End(Not run)


[Package MultiKink version 0.2.0 Index]