Title: | Continuous Threshold Expectile Regression |
---|---|
Description: | Estimation and inference methods for the continuous threshold expectile regression. It can fit the continuous threshold expectile regression and test the existence of change point, for the paper, "Feipeng Zhang and Qunhua Li (2016). A continuous threshold expectile regression, submitted." |
Authors: | Feipeng Zhang [aut, cre], Qunhua Li [aut] |
Maintainer: | Feipeng Zhang <[email protected]> |
License: | GPL (>= 2.0) |
Version: | 1.1.0 |
Built: | 2025-03-02 03:02:39 UTC |
Source: | https://github.com/cran/cthreshER |
The grid search algorithm for the continuous threshold expectile regression
cterFit(y, x, z, tau = 0.5, max.iter = 100, tol = 1e-04)
cterFit(y, x, z, tau = 0.5, max.iter = 100, tol = 1e-04)
y |
A vector of response |
x |
A scalar covariate with threshold |
z |
A vector of covariates |
tau |
the expectile level, 0.5 for default |
max.iter |
the maximum iteration steps, 100 for default |
tol |
tolerance value, 1e-4 for default |
A list with the elements
coef.est |
The estimated regression coefficients with intercept. |
threshold.est |
The estimated threshold. |
coef.se |
The estimated standard error of the regression coefficients. |
threshold.se |
The estimated standard error of the threshold. |
iter |
The iteration steps. |
Feipeng Zhang and Qunhua Li
## simulated data ptm <- proc.time() n <- 200 t0 <- 1.5 bet0 <- c(1, 3, -2, 1) tau <- 0.3 modtype <- 1 errtype <- 1 dat <- cterSimData(n, bet0, t0, tau, modtype, errtype) y <- dat[, 1] x <- dat[, 2] z <- dat[, 3] fit <- cterFit(y, x, z, tau) ## The example of Baseball pitcher salary data(data_bbsalaries) y <- data_bbsalaries$y x <- data_bbsalaries$x z <- NULL tau <- 0.5 fit <- cterFit(y, x, z, tau) proc.time() - ptm
## simulated data ptm <- proc.time() n <- 200 t0 <- 1.5 bet0 <- c(1, 3, -2, 1) tau <- 0.3 modtype <- 1 errtype <- 1 dat <- cterSimData(n, bet0, t0, tau, modtype, errtype) y <- dat[, 1] x <- dat[, 2] z <- dat[, 3] fit <- cterFit(y, x, z, tau) ## The example of Baseball pitcher salary data(data_bbsalaries) y <- data_bbsalaries$y x <- data_bbsalaries$x z <- NULL tau <- 0.5 fit <- cterFit(y, x, z, tau) proc.time() - ptm
The function for simulating data from the continuous threshold expectile regression
cterSimData(n, bet0, t0, tau = 0.5, modtype = 1, errtype = 1)
cterSimData(n, bet0, t0, tau = 0.5, modtype = 1, errtype = 1)
n |
sample size. |
bet0 |
the vecotr of true regression coefficients. |
t0 |
the true location of threshold. |
tau |
the expectile level, 0.5 for default. |
modtype |
type of model, 1 = IID for default, 2 = Heteroscedasticity,
modtype = 1, |
errtype |
type of error, 1 for default, errtype = 1 for N(0, 1), errtype = 2 for t_4, errtype = 3 for 0.9 N(0, 1) + 0.1 t_4. |
A matrix with the elements
y |
The response variable. |
x |
The scalar covariate with threshold. |
z |
A vector of covariates. |
Feipeng Zhang and Qunhua Li
## simulated data ptm <- proc.time() n <- 200 t0 <- 1.5 bet0 <- c(1, 3, -2, 1) tau <- 0.5 modtype <- 1 errtype <- 1 dat <- cterSimData(n, bet0, t0, tau, modtype, errtype) head(dat) proc.time() - ptm
## simulated data ptm <- proc.time() n <- 200 t0 <- 1.5 bet0 <- c(1, 3, -2, 1) tau <- 0.5 modtype <- 1 errtype <- 1 dat <- cterSimData(n, bet0, t0, tau, modtype, errtype) head(dat) proc.time() - ptm
This function for calculating the test statistics and p-value by wild bootstrap.
cterTest(y, x, z, tau = 0.5, NB = 1000)
cterTest(y, x, z, tau = 0.5, NB = 1000)
y |
A vector of response |
x |
A scalar covariate with threshold |
z |
A vector of covariates |
tau |
the expectile level, 0.5 for default |
NB |
resampling times, 1000 for default |
A list with the elements
Tn |
The statistic based on original data. |
Tn.NB |
The statistics by wild bootstrap. |
p.value |
The p-value by wild bootstrap. |
Feipeng Zhang and Qunhua Li
## simulated data ptm <- proc.time() set.seed(1) n <- 200 t0 <- 1.5 bet0 <- c(1, 3, 0, 1) tau <- 0.3 modtype <- 1 errtype <- 1 dat <- cterSimData(n, bet0, t0, tau, modtype, errtype) y <- dat[, 1] x <- dat[, 2] z <- dat[, 3] fit.test <- cterTest(y, x, z, tau, NB = 30) fit.test$p.value ## The example of Baseball pitcher salary data(data_bbsalaries) y <- data_bbsalaries$y x <- data_bbsalaries$x z <- NULL tau <- 0.5 fit.test <- cterTest(y, x, z, tau, NB = 30) fit.test$p.value proc.time() - ptm
## simulated data ptm <- proc.time() set.seed(1) n <- 200 t0 <- 1.5 bet0 <- c(1, 3, 0, 1) tau <- 0.3 modtype <- 1 errtype <- 1 dat <- cterSimData(n, bet0, t0, tau, modtype, errtype) y <- dat[, 1] x <- dat[, 2] z <- dat[, 3] fit.test <- cterTest(y, x, z, tau, NB = 30) fit.test$p.value ## The example of Baseball pitcher salary data(data_bbsalaries) y <- data_bbsalaries$y x <- data_bbsalaries$x z <- NULL tau <- 0.5 fit.test <- cterTest(y, x, z, tau, NB = 30) fit.test$p.value proc.time() - ptm
Salaries of 176 piters for the 1987 season. The variables are as follows:
data(data_bbsalaries)
data(data_bbsalaries)
A data frame with 176 observations on the following 2 variables.
y
Log of the base salary in dollars
x
Log of the number of years experience
Hettmansperger, T.P. and McKean J.W. (2011), Robust Nonparametric Statistical Methods, 2nd ed., New York: Chapman-Hall.
Hettmansperger, T.P. and McKean J.W. (2011), Robust Nonparametric Statistical Methods, 2nd ed., New York: Chapman-Hall.
data(data_bbsalaries) ## maybe str(data_bbsalaries) ; plot(data_bbsalaries) ...
data(data_bbsalaries) ## maybe str(data_bbsalaries) ; plot(data_bbsalaries) ...