Skip to contents

Extract the inverse cost matrix used to compute this model

Usage

costs(sim, ...)

Arguments

sim

a spatial interaction model with a cost matrix

...

additional parameters

Value

the cost matrix

Examples

positions <- matrix(rnorm(10 * 2), ncol = 2)
distances <- as.matrix(dist(positions))
production <- rep(1, 10)
attractiveness <- c(2, rep(1, 9))
model <- static_blvim(distances, production, 1.5, 1, attractiveness)
costs(model) ## should be equal to distances above
#>            1         2         3         4        5         6         7
#> 1  0.0000000 1.2113365 0.5764551 0.8922384 1.233517 2.1906378 1.4819756
#> 2  1.2113365 0.0000000 1.0972748 1.2249255 2.203481 1.1556421 0.7874124
#> 3  0.5764551 1.0972748 0.0000000 1.3579652 1.108196 1.8125682 1.6524520
#> 4  0.8922384 1.2249255 1.3579652 0.0000000 2.100317 2.3803464 0.9426093
#> 5  1.2335169 2.2034812 1.1081956 2.1003175 0.000000 2.8098090 2.6773381
#> 6  2.1906378 1.1556421 1.8125682 2.3803464 2.809809 0.0000000 1.7763899
#> 7  1.4819756 0.7874124 1.6524520 0.9426093 2.677338 1.7763899 0.0000000
#> 8  1.4388866 0.4252290 1.4580271 1.1602271 2.544453 1.3630013 0.4187325
#> 9  1.7612260 1.0713023 1.2815835 2.1829672 2.184521 0.6682563 1.8450198
#> 10 1.0221055 2.0410276 1.5830197 1.0002971 1.726330 3.1392891 1.9390690
#>            8         9       10
#> 1  1.4388866 1.7612260 1.022105
#> 2  0.4252290 1.0713023 2.041028
#> 3  1.4580271 1.2815835 1.583020
#> 4  1.1602271 2.1829672 1.000297
#> 5  2.5444530 2.1845214 1.726330
#> 6  1.3630013 0.6682563 3.139289
#> 7  0.4187325 1.8450198 1.939069
#> 8  0.0000000 1.4404009 2.101583
#> 9  1.4404009 0.0000000 2.770521
#> 10 2.1015831 2.7705213 0.000000