Learn R Programming

PSTR (version 2.0.0)

NewPSTR: Create a PSTR model object

Description

Create an R6 object of class "PSTR" to be used as the main container for Panel Smooth Transition Regression (PSTR) modelling in this package. You typically call NewPSTR() once, and then pass the returned object to specification, estimation and evaluation functions.

Usage

NewPSTR(data, dep, indep, indep_k = NULL, tvars, im = 1, iT)

Value

An R6 object of class "PSTR".

Arguments

data

A tibble containing the panel in long format. The number of rows must be iT * N for some integer N. Rows are assumed to be ordered by time within individual, consistently with the package conventions.

dep

A single column index or a single column name specifying the dependent variable.

indep

A vector of column indices or column names specifying the regressors in the linear part.

indep_k

Optional. A vector of column indices or column names specifying the regressors in the non-linear part. If NULL, the non-linear part is set equal to the linear part.

tvars

A vector of column indices or column names specifying the candidate transition variables.

im

Integer. The maximal number of switches used in linearity-related tests. Default is 1.

iT

Integer. The time dimension (number of time observations per individual).

Details

The candidate transition variables in tvars will be stored in the object and can be tested one by one by functions such as LinTest.

Missing values in the dependent variable, linear regressors, non-linear regressors, or transition variables are removed internally (row-wise). The number of individuals \(N\) is inferred from nrow(data) and iT after removing missing values.

See Also

LinTest, WCB_LinTest, EstPSTR, EvalTest, WCB_TVTest, WCB_HETest.

Examples

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

# print summary (your R6 print method)
pstr
print(pstr, mode = "summary")

# after running tests/estimation, you can print other sections
# print(pstr, mode = "tests")
# print(pstr, mode = "estimates")
# print(pstr, mode = "evaluation")
# }

Run the code above in your browser using DataLab