Learn R Programming

PSTR (version 2.0.0)

EvalTest: Evaluate an estimated PSTR model

Description

EvalTest provides post-estimation evaluation tests for an estimated PSTR model. It supports two null hypotheses:

Parameter constancy

No time variation in parameters (labelled "time-varying").

No remaining nonlinearity

No remaining nonlinearity/heterogeneity given a candidate transition variable (labelled "heterogeneity").

Usage

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

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

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

Value

Invisibly returns use with evaluation results added.

tv

A list of parameter-constancy (time-varying) test results, one element per \(m\).

ht

A list of no remaining nonlinearity (heterogeneity) test results, one element per \(m\).

wcb_tv

A numeric matrix of WB/WCB p-values for parameter-constancy tests (one row per \(m\)).

wcb_ht

A numeric matrix of WB/WCB p-values for no remaining nonlinearity tests (one row per \(m\)).

The individual list elements in tv and ht contain LM-type test statistics and p-values (including HAC variants), consistent with the output from LinTest.

Arguments

use

An object of class "PSTR" returned by EstPSTR. The model must be estimated (nonlinear PSTR) before evaluation tests can be run.

type

Character vector. Which evaluation tests to run in EvalTest. Must be a subset of c("time-varying","heterogeneity"). Default is both.

vq

Numeric vector. Candidate transition variable used by the no remaining nonlinearity test. Required if "heterogeneity" is included in type, and required for WCB_HETest.

iB

Integer. Number of bootstrap replications. Default is 100.

parallel

Logical. Whether to use parallel computation (via the snowfall backend).

cpus

Integer. Number of CPU cores used if parallel = TRUE.

Details

Wild bootstrap (WB) and wild cluster bootstrap (WCB) versions are available via WCB_TVTest (parameter constancy) and WCB_HETest (no remaining nonlinearity).

Two equivalent interfaces are available for each test:

  1. Wrapper function, for example EvalTest(use = obj, ...).

  2. R6 method, for example obj$EvalTest(...).

Each wrapper calls the corresponding R6 method and returns use invisibly.

The bootstrap variants are computationally intensive. WB is robust to heteroskedasticity, while WCB is additionally robust to within-individual dependence (cluster dependence). Parallel execution can be enabled via parallel and cpus.

See Also

NewPSTR, LinTest, WCB_LinTest, EstPSTR.

Examples

Run this code
# \donttest{
pstr <- NewPSTR(Hansen99, dep = "inva", indep = 4:20,
               indep_k = c("vala","debta","cfa","sales"),
               tvars = c("vala"), iT = 14)

# estimate first
pstr <- EstPSTR(use = pstr, im = 1, iq = 1, useDelta = TRUE, par = c(.63, 0), method = "CG")

# evaluation tests
pstr <- EvalTest(
  use = pstr,
  type = c("time-varying","heterogeneity"),
  vq = as.matrix(Hansen99[,'vala'])[,1]
)
print(pstr, mode = "evaluation")

# bootstrap variants (requires snowfall)
library(snowfall)
pstr <- WCB_TVTest(
    use = pstr, iB = 4,
    parallel = TRUE, cpus = 2)
pstr <- WCB_HETest(
    use = pstr,
    vq = as.matrix(Hansen99[,'vala'])[,1],
    iB = 4, parallel = TRUE, cpus = 2)
print(pstr, mode = "evaluation")
# }

Run the code above in your browser using DataLab