Skip to content

Commit

Permalink
Update replicaation scripts (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermebodin authored Feb 19, 2021
1 parent ceedd74 commit 108dad8
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ScoreDrivenModels"
uuid = "4a87933e-d659-11e9-0e65-7f40dedd4a3a"
authors = ["guilhermebodin <[email protected]>, raphaelsaavedra <[email protected]>"]
version = "0.1.8"
version = "0.1.7"

[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand Down
5 changes: 5 additions & 0 deletions examples/R_replication_scripts/cpichg.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
library("GAS")

GASSpec <- UniGASSpec(Dist = "std", ScalingType = "Identity", GASPar = list(location = TRUE, scale = TRUE, shape = FALSE))
cpichg <- read.csv("../../test/data/cpichg.csv", header = FALSE)
Fit <- UniGASFit(GASSpec, cpichg$V1)
7 changes: 7 additions & 0 deletions examples/R_replication_scripts/garch.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
library("rugarch")
bg96 <- read.csv("./test/data/BG96.csv", header = FALSE)

spec = ugarchspec(mean.model = list(armaOrder = c(0, 0), include.mean = FALSE, archm = FALSE,
archpow = 1, arfima = FALSE, external.regressors = NULL, archex = FALSE))
fit = ugarchfit(data = bg96$V1, spec = spec)
coef(fit)
13 changes: 9 additions & 4 deletions examples/cpichg.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using DelimitedFiles, Random, ScoreDrivenModels, Statistics
using DelimitedFiles, Random, ScoreDrivenModels, Statistics, Plots

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

gas_t = Model(1, 1, TDistLocationScale, 0.0; time_varying_params = [1])
gas_t = Model(1, 1, TDistLocationScale, 1.0; time_varying_params = [1])
steps_ahead = 50
first_idx = 150
b_t = backtest(gas_t, y, steps_ahead, first_idx)
plot(b_t, "GAS(1, 1) Student t")
using Plots
plot!(b_t, "GAS(1, 1) Student t")

gas_t_1_2 = Model(1, 2, TDistLocationScale, 1.0; time_varying_params = [1])
steps_ahead = 50
first_idx = 150
b_t_1_2 = backtest(gas_t_1_2, y, steps_ahead, first_idx)
plot(b_t, "GAS(1, 1) Student t");
plot!(b_t_1_2, "GAS(1, 2) Student t"; legend = :topleft)
7 changes: 7 additions & 0 deletions examples/introduction.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using ScoreDrivenModels

Model(1, 2, LogNormal, 0.5)

Model(1, 2, LogNormal, 0.5; time_varying_params = [1])

Model([1, 12], [1, 12], LogNormal, 0.5)
1 change: 0 additions & 1 deletion src/prints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ function Base.show(io::IO, est::EstimationStats{D, T}) where {D, T}
println(io, "Log-likelihood: ", @sprintf("%.4f", est.loglikelihood))
println(io, "AIC: ", @sprintf("%.4f", est.aic))
println(io, "BIC: ", @sprintf("%.4f", est.bic))
println(io, "Jarque Bera p value: ", @sprintf("%.4f", est.jarquebera_p_value))
print_coefs_stats(est.coefs_stats)
return nothing
end
Expand Down

2 comments on commit 108dad8

@guilhermebodin
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/30442

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.7 -m "<description of version>" 108dad8c2561582c2a4c0741456f4ea6c5b46727
git push origin v0.1.7

Please sign in to comment.