Skip to content

Commit ca1652b

Browse files
Quantile residuals (#134)
* Update scripts * Update to quantile residuals
1 parent 9387737 commit ca1652b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/MLE.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct Fitted{D <: Distribution, T <: AbstractFloat}
1313
llk::T
1414
coefs::Vector{T}
1515
numerical_hessian::Matrix{T}
16-
pearson_residuals::Vector{T}
16+
quantile_residuals::Vector{T}
1717
end
1818

1919
struct CoefsStats{T <: AbstractFloat}
@@ -37,7 +37,7 @@ end
3737
function results(f::Fitted{D, T}) where {D, T}
3838
estim_results = eval_coefs_stats(f)
3939
np = length(f.unknowns)
40-
jarquebera_p_value = pvalue(JarqueBeraTest(f.pearson_residuals))
40+
jarquebera_p_value = pvalue(JarqueBeraTest(f.quantile_residuals))
4141
return EstimationStats{D, T}(f.num_obs, f.llk, f.aic, f.bic, np,
4242
jarquebera_p_value, estim_results)
4343
end
@@ -163,8 +163,8 @@ function fit!(gas::Model{D, T}, y::Vector{T};
163163

164164
# Calculate pearson residuals
165165
pearson_res = isnan(initial_params[1]) ?
166-
pearson_residuals(y, gas) :
167-
pearson_residuals(y, gas; initial_params = initial_params)
166+
quantile_residuals(y, gas) :
167+
quantile_residuals(y, gas; initial_params = initial_params)
168168

169169
return Fitted{D, T}(n, unknowns, aic, bic, best_llk, coefs, num_hessian, pearson_res)
170170
end

src/visualization/residuals.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
RecipesBase.@recipe function f(fi::Fitted)
22
layout := (2, 2)
3-
acf = autocor(fi.pearson_residuals)[2:end]
3+
acf = autocor(fi.quantile_residuals)[2:end]
44
@series begin
55
seriestype := :path
66
label := ""
77
seriescolor := "black"
88
subplot := 1
99
marker := :circle
10-
fi.pearson_residuals
10+
fi.quantile_residuals
1111
end
1212
@series begin
1313
seriestype := :bar
@@ -39,9 +39,9 @@ RecipesBase.@recipe function f(fi::Fitted)
3939
label := ""
4040
seriescolor := "black"
4141
subplot := 3
42-
fi.pearson_residuals
42+
fi.quantile_residuals
4343
end
44-
qqpair = qqbuild(Normal(), fi.pearson_residuals)
44+
qqpair = qqbuild(Normal(), fi.quantile_residuals)
4545
@series begin
4646
seriestype := :scatter
4747
label := ""

0 commit comments

Comments
 (0)