%% Create Fully Specified Univariate STAR Model
% Create a three-state STAR model with logistic transitions (LSTAR) for a 1-D response process. Specify all parameter values (this example uses arbitrary values).
% Create smooth, logistic threshold transitions at levels 2 and 8. Specify the following transition rates:
% 3.5, when the system transitions from state 1 to state 2.
% 1.5, when the system transitions from state 2 to state 3.

t = [2 8];
r = [3.5 1.5];
tt = threshold(t,Type="logistic",Rates=r)

% tt is a fully specified threshold object.
% Assume the following univariate models describe the response process of the system:
% State 1: y_t =-5+\varepsilon_1 , where \varepsilon_1 \sim N\left(0,0\ldotp 1^2 \right).
% State 2: y_t =\varepsilon_2 , where \varepsilon_2 \sim N\left(0,0\ldotp 2^2 \right).
% State 3: y_t =5+\varepsilon_3 , where \varepsilon_3 \sim N\left(0,0\ldotp 3^2 \right).

mdl1 = arima(Constant=-5,Variance=0.1);
mdl2 = arima(Constant=0,Variance=0.2);
mdl3 = arima(Constant=5,Variance=0.3);

mdl = [mdl1,mdl2,mdl3];

% Create a STAR model from the switching mechanism tt and the state-specific submodels mdl.

Mdl = tsVAR(tt,mdl)

% Mdl is a fully specified tsVAR object representing the STAR model.
% Copyright 2021 The MathWorks, Inc.