# Recursively identified logistic Student's t STVAR(p=3, M=2) model with the first
# lag of the second variable as the switching variable:
params32logt <- c(0.5959, 0.0447, 2.6279, 0.2897, 0.2837, 0.0504, -0.2188, 0.4008,
0.3128, 0.0271, -0.1194, 0.1559, -0.0972, 0.0082, -0.1118, 0.2391, 0.164, -0.0363,
-1.073, 0.6759, 3e-04, 0.0069, 0.4271, 0.0533, -0.0498, 0.0355, -0.4686, 0.0812,
0.3368, 0.0035, 0.0325, 1.2289, -0.047, 0.1666, 1.2067, 7.2392, 11.6091)
mod32logt <- STVAR(gdpdef, p=3, M=2, params=params32logt, weight_function="logistic",
weightfun_pars=c(2, 1), cond_dist="Student", identification="recursive")
# Simulate historical counterfactual where the first variable takes the values 5 and -5
# in the first and second time periods, respectively.
cfact1 <- cfact_hist(mod32logt, cfact_type="fixed_path", policy_var=1, cfact_start=1,
cfact_end=2, cfact_path=c(5, -5))
print(cfact1, start=c(1959, 1), end=c(1960, 4)) # Print cfact data from 1959Q1 to 1960Q4
plot(cfact1) # Plot the observed and counterfactual data
# Simulate historical counterfactual where the first variable does not respond to lagged
# movements of the second variable nor to the second shock in time periods from 10 to 100.
cfact2 <- cfact_hist(mod32logt, cfact_type="muted_response", policy_var=1, mute_var=2,
cfact_start=10, cfact_end=100)
print(cfact2, start=c(1960, 4), end=c(1963, 4)) # Print cfact data from 1960Q4 to 1963Q4
plot(cfact2) # plot the observed and counterfactual data
Run the code above in your browser using DataLab