PSTR (version 1.0.1)

LinTest: Conduct the linearity tests.

Description

These functions conduct the linearity tests against the alternative of a logistic smooth transition nonlinear component.

Usage

LinTest(use)

WCB_LinTest(use, iB = 100, parallel = F, cpus = 4)

Arguments

use

an object of the class PSTR, created by NewPSTR function.

iB

specify the number of repetitions in the bootstrap procedure. By default, it is 100.

parallel

a boolean value showing if the parallel computation is applied.

cpus

number of cores used in the parallel computation. The value will be ignored if parallel=F.

Value

a new object of the class PSTR containing the results from the linearity tests.

The object is a list containing the components made in NewPSTR and the following new components:

test

a list of the linearity test results. The length is the number of potential transition variables specified when creating the object of the class PSTR by calling NewPSTR. See argument tvars in NewPSTR. Each element of the list corresponds to the linearity test results based on the corresponding transition variable, and the element is also a list whose elements correspond to different numbers of switches.

sqtest

a list of the linearity test results for selecting number of switches. It has the same length as test. Each element of the list corresponds to the linearity test results based on the corresponding transition variable, and the element is also a list whose elements correspond to different numbers of switches.

wcb_test

a list of the linearity test results. The length is the number of potential transition variables specified when creating the object of the class PSTR by calling NewPSTR. See argument tvars in NewPSTR. Each element of the list is a matrix containing the linearity test results (p-values) based on the corresponding transition variable. The rows are different numbers of switches, and two columns from WB to WCB.

wcb_sqtest

a list of the linearity test results for selecting number of switches. It has the same length as test. Each element of the list is a matrix containing the linearity test results based on the corresponding transition variable. The rows are different numbers of switches, and two columns from WB to WCB.

Details

LinTest implements the linearity tests.

WCB_LinTest implements the wild bootstrap (WB) and the wild cluster bootstrap (WCB) linearity tests.

The functions need the return value (an object of the class PSTR) from the NewPSTR. They copy the object, reuse its contents to produce the linearity test results, and then return a new object of the class PSTR. The user can choose to save the return value to a new object or simply to overwrite the object returned from NewPSTR. See the example below.

The functions conduct two kinds of linearity tests.

The first kind of tests does the linearity tests based on each potential transition variable specified in the argument tvars when the user calls the NewPSTR function. For each potential transition variable, the function conducts linearity tests for numbers of switches from 1 up to im. The linearity tests has the null hypothesis $$H_0^i: \beta_{i} = \beta_{i-1} = \beta_{i-2} = ... = \beta_{1} = 0$$ for \(i = 1, ..., m\), where \(m\) is the maximal number of switches im.

The second kind does the linearity tests for selecting the number of switches based on each potential transition variable. The linearity tests for selecting the number of switches has the null hypothesis $$H_0^i: \beta_{i} = 0 | \beta_{i+1} = \beta_{i+2} = ... = \beta_{m} = 0$$ for \(i = 1, ..., m\), where \(m\) is the maximal number of switches im.

The results of the linearity tests include four kinds of tests

  • \(\chi^2\)-version Linearity test: the linearity LM test with asymptotically \(\chi^2\) distribution under the null hypothesis of linearity.

  • F-version Linearity test: the linearity LM test with asymptotically \(F\) distribution under the null hypothesis of linearity. The finite sample actual size is supposed to be improved.

  • \(\chi^2\)-version HAC Linearity test: the linearity LM test with asymptotically \(\chi^2\) distribution under the null hypothesis of linearity, which is heteroskedasticity and autocorrelation consistent.

  • F-version HAC Linearity test: the linearity LM test with asymptotically \(F\) distribution under the null hypothesis of linearity, which is heteroskedasticity and autocorrelation consistent. The finite sample actual size is supposed to be improved.

The wild bootstrap (WB) tests are heteroskedasticity robust, while the wild cluster bootstrap (WCB) ones are both cluster-dependency and heteroskedasticity robust. Cluster-dependency implies that there can be dependency (autocorrelation) within individual, but no correlation across individuals. The WB and WCB tests may take quite a long time to run which depends on the model specification and the number of repetitions iB. It is strongly recommended to use super-computation server with many cores to run the code instead of a personal computer. The user may first try a small number of repetitions iB and estimate the time consumed for a larger number of iB.

The two functions never change the existing values in the input PSTR object. They add more values (attributes) into the input object and return.

See Also

NewPSTR

Examples

Run this code
# NOT RUN {
pstr = NewPSTR(Hansen99, dep='inva', indep=4:20, indep_k=c('vala','debta','cfa','sales'),
    tvars=c('vala'), iT=14) # create a new PSTR object

pstr = LinTest(pstr)

print(pstr, "tests")

# }
# NOT RUN {
# Don't forget to attach the package for the parallel computation.
library(snowfall)

# you should not run this on personal computer!
# pstr = WCB_LinTest(use=pstr, iB=5000, parallel=T, cpus=50)

# a light version for checking on your personal computer.
pstr = WCB_LinTest(use=pstr, iB=4, parallel=T, cpus=2)

print(pstr, "tests")
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace