Skip to content

Commit

Permalink
Change initial values spatial dependence
Browse files Browse the repository at this point in the history
  • Loading branch information
qntwrsm committed Aug 7, 2024
1 parent c3b660b commit 5f28e4f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/fit/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,14 @@ function init!(ε::SpatialAutoregression, method::Symbol)
if method == :data
# estimate spatial filter
if length(spatial(ε)) == 1
ρ = dot(weights(ε) * resid(ε), resid(ε)) / sum(abs2, weights(ε) * resid(ε))
spatial(ε) .= max(-0.99 * ε.ρ_max, min(0.99 * ε.ρ_max, ρ))
# ρ = dot(weights(ε) * resid(ε), resid(ε)) / sum(abs2, weights(ε) * resid(ε))
# spatial(ε) .= max(-0.99 * ε.ρ_max, min(0.99 * ε.ρ_max, ρ))
spatial(ε) .= 0.0
else
for i eachindex(spatial(ε))
ρi = dot(weights(ε)[i,:]' * resid(ε), resid(ε)[i,:]) / sum(abs2, weights(ε)[i,:]' * resid(ε))
spatial(ε)[i] = max(-0.99 * ε.ρ_max, min(0.99 * ε.ρ_max, ρi))
# ρi = dot(weights(ε)[i,:]' * resid(ε), resid(ε)[i,:]) / sum(abs2, weights(ε)[i,:]' * resid(ε))
# spatial(ε)[i] = max(-0.99 * ε.ρ_max, min(0.99 * ε.ρ_max, ρi))
spatial(ε)[i] = 0.0
end
end

Expand Down

0 comments on commit 5f28e4f

Please sign in to comment.