Skip to content

Commit bb1c3a5

Browse files
guilhermebodinraphaelsaavedra
authored andcommitted
link function from distributions are never used (#39)
1 parent ebe5100 commit bb1c3a5

File tree

10 files changed

+8
-41
lines changed

10 files changed

+8
-41
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Optim = "~0.19"
1515
SpecialFunctions = "~0.8"
1616
julia = "~1"
1717

18-
[targets]
19-
test = ["Test", "Random", "HypothesisTests"]
20-
2118
[extras]
2219
HypothesisTests = "09f84164-cd44-5f33-b23f-e6b0d136a0d5"
2320
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2421
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
22+
23+
[targets]
24+
test = ["Test", "Random", "HypothesisTests"]

src/distributions/beta.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ function log_likelihood(::Type{Beta}, y::Vector{T}, param::Vector{Vector{T}}, n:
3434
end
3535

3636
# Links
37-
function link(::Type{Beta}, param::Vector{T}) where T
38-
return [
39-
link(LogLink, param[1], zero(T));
40-
link(LogLink, param[2], zero(T))
41-
]
42-
end
4337
function unlink(::Type{Beta}, param_tilde::Vector{T}) where T
4438
return [
4539
unlink(LogLink, param_tilde[1], zero(T));

src/distributions/common_interface.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ end
1717
function fisher_information(D::Type{<:Distribution}, param::Vector{T}) where T
1818
return error("fisher_information not implemented for $D distribution")
1919
end
20-
function link(D::Type{<:Distribution}, param::Vector{T}) where T
21-
return error("link not implemented for $D distribution")
22-
end
2320
function unlink(D::Type{<:Distribution}, param_tilde::Vector{T}) where T
2421
return error("unlink not implemented for $D distribution")
2522
end

src/distributions/gamma.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ function log_likelihood(::Type{Gamma}, y::Vector{T}, param::Vector{Vector{T}}, n
3131
end
3232

3333
# Links
34-
function link(::Type{Gamma}, param::Vector{T}) where T
35-
return [
36-
link(LogLink, param[1], zero(T));
37-
link(LogLink, param[2], zero(T))
38-
]
39-
end
4034
function unlink(::Type{Gamma}, param_tilde::Vector{T}) where T
4135
return [
4236
unlink(LogLink, param_tilde[1], zero(T));

src/distributions/lognormal.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ function log_likelihood(::Type{LogNormal}, y::Vector{T}, param::Vector{Vector{T}
2828
end
2929

3030
# Links
31-
function link(::Type{LogNormal}, param::Vector{T}) where T
32-
return [
33-
link(IdentityLink, param[1]);
34-
link(LogLink, param[2], zero(T))
35-
]
36-
end
3731
function unlink(::Type{LogNormal}, param_tilde::Vector{T}) where T
3832
return [
3933
unlink(IdentityLink, param_tilde[1]);

src/distributions/normal.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ function log_likelihood(::Type{Normal}, y::Vector{T}, param::Vector{Vector{T}},
3131
end
3232

3333
# Links
34-
function link(::Type{Normal}, param::Vector{T}) where T
35-
return [
36-
link(IdentityLink, param[1]);
37-
link(LogLink, param[2], zero(T))
38-
]
39-
end
4034
function unlink(::Type{Normal}, param_tilde::Vector{T}) where T
4135
return [
4236
unlink(IdentityLink, param_tilde[1]);

src/distributions/poisson.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function log_likelihood(::Type{Poisson}, y::Vector{Int}, param::Vector{Vector{T}
2424
end
2525

2626
# Links
27-
link(::Type{Poisson}, param::Vector{T}) where T = link.(LogLink, param, zero(T))
2827
unlink(::Type{Poisson}, param_tilde::Vector{T}) where T = unlink.(LogLink, param_tilde, zero(T))
2928
jacobian_link(::Type{Poisson}, param_tilde::Vector{T}) where T = Diagonal(jacobian_link.(LogLink, param_tilde, zero(T)))
3029

src/distributions/weibull.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ function log_likelihood(::Type{Weibull}, y::Vector{T}, param::Vector{Vector{T}},
2828
end
2929

3030
# Links
31-
function link(::Type{Weibull}, param::Vector{T}) where T
32-
return [
33-
link(LogLink, param[1], zero(T));
34-
link(LogLink, param[2], zero(T))
35-
]
36-
end
3731
function unlink(::Type{Weibull}, param_tilde::Vector{T}) where T
3832
return [
3933
unlink(LogLink, param_tilde[1], zero(T));

src/gas/univariate_score_driven_recursion.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function score_driven_recursion(gas::GAS{D, T}, observations::Vector{T}, initial
1717
param_tilde = Vector{Vector{T}}(undef, n + 1)
1818
scores_tilde = Vector{Vector{T}}(undef, n)
1919

20+
# Query the biggest lag
2021
biggest_lag = length(initial_param_tilde)
2122

2223
# initial_values

src/utils.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ function sample_observation(dist::Distribution)
4343
return rand(dist)
4444
end
4545

46-
function find_unknowns(vec::Vector{T}) where T
47-
return findall(isnan, vec)
46+
function find_unknowns(v::Vector{T}) where T
47+
return findall(isnan, v)
4848
end
4949

50-
function find_unknowns(mat::Matrix{T}) where T
51-
return findall(isnan, vec(mat))
50+
function find_unknowns(m::Matrix{T}) where T
51+
return findall(isnan, vec(m))
5252
end

0 commit comments

Comments
 (0)