Running ‘check-ME-estimates-monte-carlo.R’ [12s/14s]
  Running ‘check-SEM-CAR-GLM-estimates-monte-carlo.R’ [9s/11s]
  Running ‘check-SLM-estimates-monte-carlo.R’ [11s/16s]
  Running ‘check-glm-for-bias.R’ [0s/0s]
  Running ‘missing-y.R’ [9s/13s]
  Running ‘model-comparison.R’ [9s/12s]
  Running ‘testthat.R’ [25s/29s]
Running the tests in ‘tests/missing-y.R’ failed.
Complete output:
  > 
  > ##
  > ## models with missing outcome data
  > ##
  > 
  > #devtools::load_all("~/dev/geostan")
  > library(geostan)
  This is geostan version 0.8.2
  > 
  > iter = 25
  > 
  > # CAR Poisson model
  > data(georgia)
  > C <- shape2mat(georgia, "B", quiet = TRUE)
  > cars <- prep_car_data(C, quiet = TRUE)
  > N = nrow(georgia)
  > georgia$deaths.female[sample.int(N, size = 12)] <- NA
  > georgia$deaths.female[sample.int(N, size = 3)] <- 0
  > 
  > fit <- stan_car(deaths.female ~ offset(log(pop.at.risk.female)),
  +                 data = georgia,
  +                 car_parts = cars,
  +                 chains = 1,
  +                 family = poisson(),
  +                 iter = iter,
  +                 quiet = TRUE) |>
  +     suppressWarnings()
  13 NA values identified in the outcome variable
  Found in rows: 10, 17, 22, 44, 55, 60, 70, 88, 96, 97, 116, 119, 126
  > 
  > 
  > # Binomial model with missing y
  > data(georgia)
  > A = shape2mat(georgia, "B")
  Contiguity condition: queen
  Number of neighbors per unit, summary:
     Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    1.000   4.000   5.000   5.409   6.000  10.000 
  
  Spatial weights, summary:
     Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
        1       1       1       1       1       1 
  > N = nrow(A)
  > georgia$deaths.female[sample.int(N, size = 25)] <- NA    
  > georgia$y <- round(georgia$deaths.female / 10)
  > georgia$y[sample.int(N, 5)] <- 0
  > georgia$f <- round(4 * georgia$deaths.female / 10)
  > 
  > 
  > # glm
  > fit <- stan_glm(cbind(y, f) ~ 1,
  +                 data = georgia,
  +                 chains = 1,
  +                 family = binomial(),
  +                 iter = iter,
  +                 quiet = TRUE) |>
  +     suppressWarnings()
  27 NA values identified in the outcome variable
  Found in rows: 3, 4, 31, 53, 55, 58, 60, 66, 79, 80, 81, 82, 91, 92, 93, 96, 117, 121, 126, 132, 136, 137, 144, 146, 148, 154, 157
  > 
  > # icar
  > fit <- stan_icar(cbind(deaths.female, pop.at.risk.female) ~ 1,
  +                  data = georgia,
  +                  type = 'bym',
  +                  C = A,
  +                  chains = 1,
  +                  family = binomial(),
  +                  iter = iter,
  +                  quiet = TRUE) |>
  +     suppressWarnings()
  27 NA values identified in the outcome variable
  Found in rows: 3, 4, 31, 53, 55, 58, 60, 66, 79, 80, 81, 82, 91, 92, 93, 96, 117, 121, 126, 132, 136, 137, 144, 146, 148, 154, 157
  > 
  > # esf
  > data(georgia)
  > georgia$deaths.female[1:10] <- NA
  > georgia$y <- georgia$deaths.female
  > georgia$f <- round(4 * georgia$deaths.female)
  > 
  > fit <- stan_esf(cbind(y, f) ~ log(income),
  +                 data = georgia,
  +                 C = shape2mat(georgia, "B"),
  +                 chains = 1,
  +                 family = binomial(),
  +                 iter = iter,
  +                 quiet = TRUE) |>
  +     suppressWarnings()
  Contiguity condition: queen
  Number of neighbors per unit, summary:
     Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    1.000   4.000   5.000   5.409   6.000  10.000 
  
  Spatial weights, summary:
     Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
        1       1       1       1       1       1 
  13 NA values identified in the outcome variable
  Found in rows: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 55, 126, 157
  Error in file(messages, open = "wt") : cannot open the connection
  Execution halted