File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed
Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -141,19 +141,12 @@ spatial(ε::SpatialAutoregression) = ε.ρ
141141spatial (ε:: SpatialMovingAverage ) = ε. ρ
142142weights (ε:: SpatialAutoregression ) = ε. W
143143weights (ε:: SpatialMovingAverage ) = ε. W
144- function poly (ε:: SpatialAutoregression )
145- if length (spatial (ε)) == 1
146- return I - spatial (ε) .* weights (ε)
147- else
148- return I - Diagonal (spatial (ε)) * weights (ε)
149- end
150- end
151- function poly (ε:: SpatialMovingAverage )
152- if length (spatial (ε)) == 1
153- return I + spatial (ε) .* weights (ε)
154- else
155- return I + Diagonal (spatial (ε)) * weights (ε)
156- end
144+ poly (ε:: SpatialAutoregression ) = poly (spatial (ε), weights (ε), :ar )
145+ poly (ε:: SpatialMovingAverage ) = poly (spatial (ε), weights (ε), :ma )
146+ function poly (ρ:: AbstractVector , W:: AbstractMatrix , type:: Symbol )
147+ common = length (ρ) == 1 ? ρ .* W : Diagonal (ρ) * W
148+
149+ return type == :ar ? I - common : I + common
157150end
158151Base. copy (ε:: Simple ) = Simple (copy (cov (Σ)))
159152function Base. copy (ε:: SpatialAutoregression )
You can’t perform that action at this time.
0 commit comments