Skip to contents

Extract the 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 4.239041 1.4598588 0.7646075 2.4711402 2.1714209 2.4587728
#> 2  4.2390415 0.000000 2.7797350 3.4745286 2.2311300 3.0366996 3.7006290
#> 3  1.4598588 2.779735 0.0000000 0.6963211 1.2634126 1.4541831 2.1176702
#> 4  0.7646075 3.474529 0.6963211 0.0000000 1.8080017 1.7040676 2.1944022
#> 5  2.4711402 2.231130 1.2634126 1.8080017 0.0000000 0.8112109 1.5254825
#> 6  2.1714209 3.036700 1.4541831 1.7040676 0.8112109 0.0000000 0.7528546
#> 7  2.4587728 3.700629 2.1176702 2.1944022 1.5254825 0.7528546 0.0000000
#> 8  2.7303195 3.727814 2.3372940 2.4518992 1.6200450 0.9155834 0.2716855
#> 9  2.7225881 2.611763 1.7458539 2.1644572 0.6059160 0.6168015 1.1012513
#> 10 3.4855391 3.400877 2.7777932 3.0735461 1.6982736 1.3704633 1.1293408
#>            8         9        10
#> 1  2.7303195 2.7225881 3.4855391
#> 2  3.7278139 2.6117633 3.4008767
#> 3  2.3372940 1.7458539 2.7777932
#> 4  2.4518992 2.1644572 3.0735461
#> 5  1.6200450 0.6059160 1.6982736
#> 6  0.9155834 0.6168015 1.3704633
#> 7  0.2716855 1.1012513 1.1293408
#> 8  0.0000000 1.1177616 0.8976815
#> 9  1.1177616 0.0000000 1.0944632
#> 10 0.8976815 1.0944632 0.0000000