cterTest: test the existence of change point in the continuous...

Description Usage Arguments Value Author(s) Examples

View source: R/cterTest.R

Description

This function for calculating the test statistics and p-value by wild bootstrap.

Usage

1
cterTest(y, x, z, tau = 0.5, NB = 1000)

Arguments

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

Value

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.

Author(s)

Feipeng Zhang and Qunhua Li

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## 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

cthreshER documentation built on May 2, 2019, 7:58 a.m.