Skip to content

Commit 108dad8

Browse files
Update replicaation scripts (#131)
1 parent ceedd74 commit 108dad8

File tree

6 files changed

+29
-6
lines changed

6 files changed

+29
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ScoreDrivenModels"
22
uuid = "4a87933e-d659-11e9-0e65-7f40dedd4a3a"
33
authors = ["guilhermebodin <[email protected]>, raphaelsaavedra <[email protected]>"]
4-
version = "0.1.8"
4+
version = "0.1.7"
55

66
[deps]
77
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
library("GAS")
2+
3+
GASSpec <- UniGASSpec(Dist = "std", ScalingType = "Identity", GASPar = list(location = TRUE, scale = TRUE, shape = FALSE))
4+
cpichg <- read.csv("../../test/data/cpichg.csv", header = FALSE)
5+
Fit <- UniGASFit(GASSpec, cpichg$V1)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
library("rugarch")
2+
bg96 <- read.csv("./test/data/BG96.csv", header = FALSE)
3+
4+
spec = ugarchspec(mean.model = list(armaOrder = c(0, 0), include.mean = FALSE, archm = FALSE,
5+
archpow = 1, arfima = FALSE, external.regressors = NULL, archex = FALSE))
6+
fit = ugarchfit(data = bg96$V1, spec = spec)
7+
coef(fit)

examples/cpichg.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using DelimitedFiles, Random, ScoreDrivenModels, Statistics
1+
using DelimitedFiles, Random, ScoreDrivenModels, Statistics, Plots
22

33
# Load historical Consumer Price Index data
44
y = vec(readdlm("../test/data/cpichg.csv"))
@@ -39,10 +39,15 @@ forec.parameter_forecast
3939
# Similarly, we can access the simulated observation scenarios
4040
forec.observation_scenarios
4141

42-
gas_t = Model(1, 1, TDistLocationScale, 0.0; time_varying_params = [1])
42+
gas_t = Model(1, 1, TDistLocationScale, 1.0; time_varying_params = [1])
4343
steps_ahead = 50
4444
first_idx = 150
4545
b_t = backtest(gas_t, y, steps_ahead, first_idx)
4646
plot(b_t, "GAS(1, 1) Student t")
47-
using Plots
48-
plot!(b_t, "GAS(1, 1) Student t")
47+
48+
gas_t_1_2 = Model(1, 2, TDistLocationScale, 1.0; time_varying_params = [1])
49+
steps_ahead = 50
50+
first_idx = 150
51+
b_t_1_2 = backtest(gas_t_1_2, y, steps_ahead, first_idx)
52+
plot(b_t, "GAS(1, 1) Student t");
53+
plot!(b_t_1_2, "GAS(1, 2) Student t"; legend = :topleft)

examples/introduction.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using ScoreDrivenModels
2+
3+
Model(1, 2, LogNormal, 0.5)
4+
5+
Model(1, 2, LogNormal, 0.5; time_varying_params = [1])
6+
7+
Model([1, 12], [1, 12], LogNormal, 0.5)

src/prints.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ function Base.show(io::IO, est::EstimationStats{D, T}) where {D, T}
66
println(io, "Log-likelihood: ", @sprintf("%.4f", est.loglikelihood))
77
println(io, "AIC: ", @sprintf("%.4f", est.aic))
88
println(io, "BIC: ", @sprintf("%.4f", est.bic))
9-
println(io, "Jarque Bera p value: ", @sprintf("%.4f", est.jarquebera_p_value))
109
print_coefs_stats(est.coefs_stats)
1110
return nothing
1211
end

0 commit comments

Comments
 (0)