Skip to content

Commit 38872c1

Browse files
committed
Update init of spatial error models
1 parent 5f28e4f commit 38872c1

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

src/fit/utilities.jl

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,8 @@ init!(μ::Exogenous, method::Symbol, y::AbstractMatrix) = method == :data && (sl
176176
init!::Simple, method::Symbol) = method == :data && (cov(ε).diag .= var(resid(ε), dims=2))
177177
function init!::SpatialAutoregression, method::Symbol)
178178
if method == :data
179-
# estimate spatial filter
180-
if length(spatial(ε)) == 1
181-
# ρ = dot(weights(ε) * resid(ε), resid(ε)) / sum(abs2, weights(ε) * resid(ε))
182-
# spatial(ε) .= max(-0.99 * ε.ρ_max, min(0.99 * ε.ρ_max, ρ))
183-
spatial(ε) .= 0.0
184-
else
185-
for i eachindex(spatial(ε))
186-
# ρi = dot(weights(ε)[i,:]' * resid(ε), resid(ε)[i,:]) / sum(abs2, weights(ε)[i,:]' * resid(ε))
187-
# spatial(ε)[i] = max(-0.99 * ε.ρ_max, min(0.99 * ε.ρ_max, ρi))
188-
spatial(ε)[i] = 0.0
189-
end
190-
end
179+
# spatial filter
180+
spatial(ε) .= zero(eltype(spatial(ε)))
191181

192182
# estimate covariance matrix
193183
resid(ε) .= poly(ε) * resid(ε)
@@ -198,16 +188,8 @@ function init!(ε::SpatialAutoregression, method::Symbol)
198188
end
199189
function init!::SpatialMovingAverage, method::Symbol)
200190
if method == :data
201-
# estimate spatial filter
202-
if length(spatial(ε)) == 1
203-
ρ = dot(weights(ε) * resid(ε), resid(ε)) / sum(abs2, weights(ε) * resid(ε))
204-
spatial(ε) .= max(-0.99 * ε.ρ_max, min(0.99 * ε.ρ_max, ρ))
205-
else
206-
for i eachindex(spatial(ε))
207-
ρi = dot(weights(ε)[i,:]' * resid(ε), resid(ε)[i,:]) / sum(abs2, weights(ε)[i,:]' * resid(ε))
208-
spatial(ε)[i] = max(-0.99 * ε.ρ_max, min(0.99 * ε.ρ_max, ρi))
209-
end
210-
end
191+
# spatial filter
192+
spatial(ε) .= zero(eltype(spatial(ε)))
211193

212194
# estimate covariance matrix
213195
resid(ε) .= poly(ε) \ resid(ε)

0 commit comments

Comments
 (0)