예제 #1
0
β = numpy.matrix([1.0, -0.25, -0.5])
a = numpy.matrix([[0.5, 0.0, 0.0],
                  [0.0, 0.5, 0.0],
                  [0.0, 0.0, 0.5]])
Ω = numpy.matrix([[1.0, 0.0, 0.0],
                  [0.0, 1.0, 0.0],
                  [0.0, 0.0, 1.0]])

title = title_prefix
labels = [r"$x_1$", r"$x_2$", r"$x_3$"]
plot = f"vecm_analysis_{example}_samples"
df = vecm.vecm_generate_sample(α, β, a, Ω, nsample)

# %%

vecm.comparison_plot(title, df, α.T, β, labels, [0.1, 0.075], plot)

# %%
# Swap columns

cols = df.columns
df = df[[cols[2], cols[1], cols[0]]]
df.head()
df.columns
vecm.comparison_plot(title, df, α.T, β, labels, [0.65, 0.075], plot)

# %%

vecm.sample_adf_test(df, report=True)

# %%
예제 #2
0
df = vecm.vecm_generate_sample(α, β, a, Ω, nsample)

# %%

example = 1
rank = 1
maxlags = 1
title_prefix = f"Trivariate VECM: Rank={rank}, Maxlags={maxlags}, "

# %%

title = title_prefix
labels = [r"$x_1$", r"$x_2$", r"$x_3$"]
plot = f"vecm_prediction_{example}_samples"

vecm.comparison_plot(title, df, α.T, β, labels, [0.45, 0.075], plot)

# %%

vecm_result = vecm.vecm_estimate(df, maxlags, rank, report=True)

# %%

train = vecm.vecm_train(df, maxlags, rank, 10)

# %%

var = "x1"
title = title_prefix + r" $x_1$ Training"
plot = f"vecm_prediction_{example}_x1_training"
vecm.training_plot(title, train, var, [0.7, 0.2], plot)