Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NA in probability vector with SMC #81

Closed
christopherkenny opened this issue May 7, 2021 · 1 comment
Closed

NA in probability vector with SMC #81

christopherkenny opened this issue May 7, 2021 · 1 comment
Assignees
Labels
Milestone

Comments

@christopherkenny
Copy link
Member

library(redist) # 3.0.7
#> 
#> Attaching package: 'redist'
#> The following object is masked from 'package:stats':
#> 
#>     filter
library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
library(tidyverse)
#> Warning: package 'tibble' was built under R version 4.0.5
bb <-st_sfc(st_polygon(list(rbind(c(0,0), c(1,0), c(1,1), c(0,0)))))
grid <- st_make_grid(bb)
tb <- st_as_sf(grid)
tb <- tb %>% rename(geometry = x)
tb <- tb %>% mutate(pop = 1)
box_map <- redist_map(tb, ndists = 4, pop_tol = 0.1, total_pop = pop)
#> Warning in redist_map(tb, ndists = 4, pop_tol = 0.1, total_pop = pop): Missing
#> CRS, assuming NAD83 (4269).
#> Projecting to CRS 3857
set.seed(1)
test <- redist_smc(box_map, 10)
#> SEQUENTIAL MONTE CARLO
#> Sampling 10 100-unit maps with 4 districts and population between 22.5 and 27.5.
#> Making split 1 of 3
#> Using k = 4
#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated
#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated
#> 71.4% acceptance rate.
#> Resampling effective sample size: n (n% efficiency).
#> Making split 2 of 3
#> Using k = 4
#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated
#> 55.6% acceptance rate.
#> Resampling effective sample size: n (n% efficiency).
#> Making split 3 of 3
#> Using k = 4
#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated

#> Warning in smc_plans(nsims, adj, counties, pop, ndists, pop_bounds[2],
#> pop_bounds[1], : printing of extremely long output is truncated
#> 40.0% acceptance rate.
#> Resampling effective sample size: n (n% efficiency).
#> Error in sample.int(x, size, replace, prob): NA in probability vector

Created on 2021-05-07 by the reprex package (v1.0.0)

Fails using master branch ( version 3.0.7)

Reprex on Windows results in many, many printing warnings(), but those are standard due to the use of Rprintf() within SMC's backend

@CoryMcCartan CoryMcCartan self-assigned this May 7, 2021
@CoryMcCartan CoryMcCartan added this to the 3.1 milestone May 7, 2021
CoryMcCartan added a commit that referenced this issue Jun 10, 2021
@CoryMcCartan
Copy link
Member

Fixed by d0bcce6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants