Module: SpatialStats::Utils::Lag
- Defined in:
- lib/spatial_stats/utils/lag.rb
Overview
Lag includes methdos for computing spatially lagged variables under different contexts.
Class Method Summary collapse
-
.neighbor_average(matrix, variables) ⇒ Array
Dot product of the row_standardized input matrix by the input vector, variables.
-
.neighbor_sum(matrix, variables) ⇒ Array
Dot product of the input matrix by the input vector, variables.
-
.window_average(matrix, variables) ⇒ Array
Dot product of the input windowed, row standardized matrix by the input vector, variables.
-
.window_sum(matrix, variables) ⇒ Array
Dot product of the input windowed matrix by the input vector, variables.
Class Method Details
.neighbor_average(matrix, variables) ⇒ Array
Dot product of the row_standardized input matrix by the input vector, variables.
18 19 20 21 |
# File 'lib/spatial_stats/utils/lag.rb', line 18 def self.neighbor_average(matrix, variables) matrix = matrix.standardize neighbor_sum(matrix, variables) end |
.neighbor_sum(matrix, variables) ⇒ Array
Dot product of the input matrix by the input vector, variables.
30 31 32 |
# File 'lib/spatial_stats/utils/lag.rb', line 30 def self.neighbor_sum(matrix, variables) matrix.sparse.mulvec(variables) end |
.window_average(matrix, variables) ⇒ Array
Dot product of the input windowed, row standardized matrix by the input vector, variables.
42 43 44 45 |
# File 'lib/spatial_stats/utils/lag.rb', line 42 def self.window_average(matrix, variables) matrix = matrix.window.standardize window_sum(matrix, variables) end |
.window_sum(matrix, variables) ⇒ Array
Dot product of the input windowed matrix by the input vector, variables.
55 56 57 58 |
# File 'lib/spatial_stats/utils/lag.rb', line 55 def self.window_sum(matrix, variables) matrix = matrix.window matrix.sparse.mulvec(variables) end |