Learn R Programming

tsDyn (version 11.0.4.1)

MakeThSpec: Specification of the threshold search

Description

This optional function allows the user to set different restrictions for the threshold grid search in function selectSETAR.

Usage

MakeThSpec(
  ngrid = c("All", "Half", "Third", "Quarter"),
  exact = NULL,
  int = c("from", "to"),
  around = "val",
  ...
)

Value

The input values are given as output after checking for consistency (only one of exact/int/around should be given).

Arguments

ngrid

The number of values to search for

exact

The user give an exact threshold value

int

The user gives an interval to search inside

around

The user gives an point to search around

...

currently unused

Author

Matthieu Stigler

Details

This function is just to check the inputs for the specification of the grid search. If not provided, the search will be in the biggest interval (ngrid ="All") between the minimum and maximum values. The user can reduce it by giving setting "Half" (only every two points is taken) and so on, or setting a number.

The search can also be made around a point, or between two points. When between a point, the argument ngrid is still used, whereas for around, a value of 30 is taken as default value if ngrid is not specified by user.

See Also

selectSETAR

Examples

Run this code

sun<-(sqrt(sunspot.year+1)-1)*2		
selectSETAR(sun, m=3, th=MakeThSpec(exact=10.40967),criterion="SSR", d=1, thDelay=0:2,
           plot=FALSE, nthresh=1)
#when pre-sepcified value does not correspond, function will search nearest value
selectSETAR(sun, m=3, th=MakeThSpec(exact=10.4),criterion="SSR", d=1, thDelay=0:2,
           plot=FALSE, nthresh=1)
#search around:
selectSETAR(sun, m=3, th=MakeThSpec(around=10.40967, ngrid=20),criterion="SSR", d=1, thDelay=0:2,
           plot=FALSE, nthresh=1)
#search in an interval
selectSETAR(sun, m=3, th=MakeThSpec(int=c(10, 11), ngrid=20),criterion="SSR", d=1, thDelay=0:2,
           plot=FALSE, nthresh=1)
#reduce size of the grid:
selectSETAR(sun, m=3, th=MakeThSpec(ngrid="Half"),criterion="SSR", d=1, thDelay=0:2,
           plot=FALSE, nthresh=1)


# 2 thresholds:
selectSETAR(sun, m=3, th=MakeThSpec(ngrid="Half"),criterion="SSR", d=1, thDelay=0:2,
           plot=FALSE, nthresh=2)


Run the code above in your browser using DataLab