hystar_fit {hystar} | R Documentation |
Estimate the HysTAR model using conditional least squares estimation
Description
This function allows you to estimate the parameters of the hysteretic threshold autoregressive (HysTAR) model.
Usage
hystar_fit(
data,
r = c(0.1, 0.9),
d = 0L,
p0 = 1L,
p1 = 1L,
p_select = "bic",
thin = FALSE,
tar = FALSE
)
Arguments
data |
a vector, matrix or data.frame containing the outcome variable
|
r |
A vector or a matrix with search values for
|
d |
A numeric vector with one or more values for the search space of the delay parameter. Defaults to 1. Typically, d is not very large, so a reasonable search space might be 0, 1, 2, ..., 5. |
p0 |
A numeric vector with one or more values for the search space of the autoregressive order of Regime 0. Defaults to 1. |
p1 |
Same as |
p_select |
The information criterion that should be minimized to select
the orders
|
thin |
|
tar |
|
Details
In regime 0, is predicted by values up to
.
This implies that the first
time points can not be predicted. E.g.,
if
,
would miss a value from
. Similarly, the
value of the delay parameter implies that the regime is unknown for the first
time points. To ensure that the same data are used on all options for
d
, p0
and p1
, the first max(d, p0, p1)
observations are discarded for
estimation of the parameters.
Value
An object of S3 class hystar_fit
, which is a list
containing the following
items:
-
$data
. Adata.frame
containing-
y
, the outcome variable -
z
, the threshold variable -
H
, a logical vector that indicates at which time points the hysteresis effect is happening. Note that this vector starts withNA
(s), since not all values can be predicted in the HysTAR model. See Details. -
R
, the regime indicator vector. (Also starts withNA
(s).)
-
-
$residuals
. Also accessible with theresiduals()
S3 method. -
$coefficients
, a vector with the estimated coefficients. With thecoef()
S3 method, the coefficients are represented in a matrix. Use theconfint()
method to get the confidence intervals of the estimates. -
$delay
, a scalar with the estimate for the delay parameter. -
$thresholds
, a vector with the estimates of the thresholds. -
$orders
, a vector with the estimates of the orders. -
$resvar
, a vector with the estimates of the residual variances. -
$rss
, the minimized residual sum of squares. -
$ic
, a vector with the aic, the corrected aic and the bic. -
$n
, a vector with the total effective observations and the effective obeservations in regime 0 and regime 1. -
$eff
, a vector with the time indicators of the effective observations. -
$equiv
, a matrix containing equivalent estimates for the delay and thresholds, i.e., estimates that imply exactly the same regime indicator vector, and as a result the same minimal residual sum of squares. -
$r_search
, a vector with the-values that were considered.
-
$tar
, Logical:TRUE
if a TAR model was fitted.
Implemented generics for the hystar_fit
class:
-
plot()
plots thez
variable and they
variable above one another. Shading of the background visualizes the regimes. Thresholds are drawn as horizontal lines in thez
plot. You can provide regime_names (char vector of 2), main (char vector of 1), xlab (char vector of 1) and ylab (char vector of 2). -
summary()
, this also provides the p-values and standard errors for the estimates of the coefficients. -
print()
prints the estimates within the mathematical representation of the model. Note that the scalar multiplied withe[t]
is the standard deviation of the residuals, not the variance. See also the model definition above. -
coef()
-
confint()
-
residuals()
-
fitted()
-
nobs()
The HysTAR model
The HysTAR model is defined as:
with
where denotes the order of regime
with
coefficients
,
is the standard deviation of the residuals, and
is a delay parameter. The parameters of primary interest are
the thresholds
. We let
, where
is the number of observations.
Author(s)
Daan de Jong.
References
Li, Guodong, Bo Guan, Wai Keung Li, en Philip L. H. Yu. ‘Hysteretic Autoregressive Time Series Models’. Biometrika 102, nr. 3 (september 2015): 717–23.
Zhu, Ke, Philip L H Yu, en Wai Keung Li. ‘Testing for the Buffered Autoregressive Process’. Munich Personal RePEc Archive, (november 2013).
Examples
z <- z_sim(n_t = 200, n_switches = 5, start_regime = 1)
sim <- hystar_sim(z = z, r = c(-.5, .5), d = 2, phi_R0 = c(0, .6), phi_R1 = 1)
plot(sim)
fit <- hystar_fit(sim$data)
summary(fit)