alarm-redist / redist

Simulation methods for legislative redistricting.
https://alarm-redist.github.io/redist/
GNU General Public License v2.0
67 stars 23 forks source link

NaN sim output with multisplits #102

Closed kuriwaki closed 3 years ago

kuriwaki commented 3 years ago

Using multisplits produces Resampling effective sample size: nan (nan efficiency). A simple example is below.

library(redist)
#> 
#> Attaching package: 'redist'
#> The following object is masked from 'package:stats':
#> 
#>     filter
packageVersion("redist")
#> [1] '3.1.1'
data(iowa)

ia_map = redist_map(iowa, ndists = 5, pop_tol=0.1)

set.seed(1)
sim_multi = redist_smc(
  ia_map, 
  nsims = 1e2, 
  counties = region,
  constraints = list(multisplits = list(strength = 1e3))
  )
#> SEQUENTIAL MONTE CARLO
#> Sampling 100 99-unit maps with 5 districts and population between 548344 and 670198.
#> Ensuring no more than 4 splits of the 5 administrative units.
#> Making split 1 of 4
#> Using k = 7
#> Iteration 10/100
#> Iteration 20/100
#> Iteration 30/100
#> Iteration 40/100
#> Iteration 50/100
#> Iteration 60/100
#> Iteration 70/100
#> Iteration 80/100
#> Iteration 90/100
#> Iteration 100/100
#> 33.557% acceptance rate.
#> Resampling effective sample size: 97.8495 (97.8495 efficiency).
#> Making split 2 of 4
#> Using k = 6
#> Iteration 10/100
#> Iteration 20/100
#> Iteration 30/100
#> Iteration 40/100
#> Iteration 50/100
#> Iteration 60/100
#> Iteration 70/100
#> Iteration 80/100
#> Iteration 90/100
#> Iteration 100/100
#> 36.1011% acceptance rate.
#> Resampling effective sample size: nan (nan efficiency).
#> Making split 3 of 4
#> Using k = 5
#> Iteration 10/100
#> Iteration 20/100
#> Iteration 30/100
#> Iteration 40/100
#> Iteration 50/100
#> Iteration 60/100
#> Iteration 70/100
#> Iteration 80/100
#> Iteration 90/100
#> Iteration 100/100
#> 65.3595% acceptance rate.
#> Resampling effective sample size: nan (nan efficiency).
#> Making split 4 of 4
#> Using k = 5
#> Iteration 10/100
#> Iteration 20/100
#> Iteration 30/100
#> Iteration 40/100
#> Iteration 50/100
#> Iteration 60/100
#> Iteration 70/100
#> Iteration 80/100
#> Iteration 90/100
#> Iteration 100/100
#> 7.45712% acceptance rate.
#> Resampling effective sample size: nan (nan efficiency).

Created on 2021-10-13 by the reprex package (v0.3.0)

christopherkenny commented 3 years ago

Wifi issues see #106