PSTR (version 1.0.1)

EvalTest: Conduct the evaluation tests.

Description

These functions conduct the evaluation tests against two alternatives: 1. the parameters are time-varying and 2. there is remaining nonlinearity (remaining heterogeneity).

Usage

EvalTest(use, type = c("time-varying", "heterogeneity"), vq = NULL)

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

WCB_HETest(use, vq, iB = 100, parallel = F, cpus = 4)

Arguments

use

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

type

a character vector specifying the types of the evaluation tests to be conducted. The value can be taken either or both of "time-varying" "heterogeneity". By default, do both.

vq

a vector of a new transition variable for the no remaining nonlinearity test.

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 evaluation tests.

The return object from EvalTest contains the following new components:

tv

a list of the time-varying evaluation tests. The length of the list is the maximal number of switches. Each element of the list corresponds to the time-varying evaluation test results based on different number of switches.

ht

a list of the no remaining nonlinearity (no remaining heterogeneity) evaluation tests. The length of the list is the maximal number of switches. Each element of the list corresponds to the time-varying evaluation test results based on different number of switches. The input vector of a new transition variable is used to compute the tests.

The return object from WCB_TVTest contains the following new component:

wcb_tv

a matrix containing the results from the WB and WCB time-varying tests. Each row of the matrix contains the p-value of the WB and WCB tests.

The return object from WCB_HETest contains the following new component:

wcb_ht

a matrix containing the results from the WB and WCB no remaining nonlinearity (heterogeneity) tests. Each row of the matrix contains the p-value of the WB and WCB tests.

Details

EvalTest implements the evaluation tests.

WCB_TVTest implements the wild bootstrap (WB) and the wild cluster bootstrap (WCB) evaluation test of no time-varying parameters.

WCB_HETest implements the wild bootstrap (WB) and the wild cluster bootstrap (WCB) evaluation test of no remaining nonlinearity (no remaining heterogeneity).

The functions need the return value (an object of the class PSTR) from the EstPSTR. The model should be estimated before conducting the evaluation tests. They copy the object, reuse its contents, especially the estimates, to produce the evaluation 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 EstPSTR. See the example below.

The functions conduct two kinds of evaluation tests. The first kind of tests does the time-varying evaluation tests. The second kind of tests does the no remaining nonlinearity (no remaining heterogeneity) evaluation tests based on the vector of a new transition variable that the user input in the arguments.

The results of the evaluation tests include four kinds of tests

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

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

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

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

The wild bootstrap (WB) evaluation 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 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, LinTest, WCB_LinTest and EstPSTR

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

# Estimate the model first
pstr = EstPSTR(use=pstr, im=1, iq=1, par=c(1.6,.5), method='CG')

# Then you can evaluate the model
pstr = EvalTest(use=pstr, vq=pstr$mQ[,1])

print(pstr, "eval")

# You can do the wild bootstrap and wild cluster bootstrap

library(snowfall)

pstr = WCB_TVTest(use=pstr, iB=4, parallel=T, cpus=2)

# pstr$mQ[,1] is the transition variable stored in the object
# You can also try other transition variables.
pstr = WCB_HETest(use=pstr, vq=pstr$mQ[,1], iB=4, parallel=T, cpus=2)

print(pstr, "eval")

# Don't forget to change the values of iB and cpus during experiments.
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace