ConnorDonegan / geostan

Bayesian spatial analysis

Home Page:https://connordonegan.github.io/geostan

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

indexing off in CAR model

bgoodri opened this issue · comments

If you run the "CAR with censored y" unit test with StanHeaders / rstan 2.32.x and compile the model without optimization (i.e. -00 in ~/.R/Makevars), you should see

Chain 1: Exception: Exception: Exception: vector[multi] indexing: accessing element out of range. index 0 out of range; expecting index to be between 1 and 1 (in 'foundation', line 88, column 2 to column 33) (in 'foundation', line 149, column 4 to column 102) (in 'foundation', line 622, column 6 to line 627, column 22)

Line 88 in the file -- after resolving the #includes is from this function

real car_normal_lpdf(vector y, vector mu,
       real tau, real rho,
       vector ImC, array[] int ImC_v, array[] int ImC_u, array[] int Cidx,
       vector D_inv, real log_det_D_inv, vector lambda,
       int n) {
  vector[n] z = y - mu;
  vector[num_elements(ImC)] ImrhoC = ImC; // (I - rho C)
  vector[n] zMinv = (1 / tau^2) * z .* D_inv; // z' * M-1
  vector[n] ImrhoCz; // (I - rho * C) * z
  vector[n] ldet_ImrhoC;
  ImrhoC[Cidx] = rho * ImC[Cidx]; # THIS IS LINE 88
  ImrhoCz = csr_matrix_times_vector(n, n, ImrhoC, ImC_v, ImC_u, z);
  for (i in 1:n) ldet_ImrhoC[i] = log1m(rho * lambda[i]);
  return 0.5 * (
  -n * log( 2 * pi() )
  - 2 * n * log(tau)
  + log_det_D_inv
  + sum(ldet_ImrhoC)
  - dot_product(zMinv, ImrhoCz)
  );
}

I don't know how this didn't get caught by a previous version of Stan or how it works on my Ubuntu server, but it is now causing a segfault on CRAN when I try to upload StanHeaders 2.32. If you need a StanHeaders 2.32, you can get it from here and you can install rstan 2.32 from CRAN, even though it is currently using the Stan 2.26 era parser.

Below is a file of data that can be loaded with rstan::read_rdump("geostan_data.R")

n_mis <- 3
n_obs <- 156
y_mis_idx <- 
c(55, 126, 157)
y_obs_idx <- 
c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 127, 128, 129, 130, 131, 132,
133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
149, 150, 151, 152, 153, 154, 155, 156, 158, 159)
censor_point <- 9
family <- 3
prior_only <- 0
y <- 
c(86, 56, 220, 1422, 241, 1258, 124, 172, 29, 62, 86, 93, 64, 29, 93, 43,
92, 48, 112, 67, 41, 35, 45, 32, 247, 228, 323, 36, 1310, 26, 70, 63, 49, 131,
86, 146, 34, 26, 17, 286, 157, 30, 79, 32, 45, 39, 38, 28, 62, 70, 96, 420, 55,
131, 0, 56, 116, 68, 31, 202, 89, 711, 362, 23, 102, 296, 28, 34, 12, 316, 56,
52, 152, 2026, 67, 167, 71, 13, 89, 10, 282, 97, 66, 80, 91, 42, 33, 586, 143,
42, 27, 172, 204, 76, 104, 241, 11, 139, 236, 488, 335, 356, 770, 40, 20, 141,
31, 78, 53, 34, 250, 142, 83, 280, 379, 82, 12, 68, 68, 119, 672, 40, 66, 83,
68, 0, 30, 61, 14, 73, 62, 112, 68, 83, 45, 284, 147, 36, 123, 74, 30, 76, 41,
37, 30, 85, 49, 39, 754, 288, 122, 54, 308, 159, 332, 123, 0, 162, 119)
y_int <- 
c(86, 56, 220, 1422, 241, 1258, 124, 172, 29, 62, 86, 93, 64, 29, 93,
43, 92, 48, 112, 67, 41, 35, 45, 32, 247, 228, 323, 36, 1310, 26, 70, 63, 49,
131, 86, 146, 34, 26, 17, 286, 157, 30, 79, 32, 45, 39, 38, 28, 62, 70, 96, 420,
55, 131, 0, 56, 116, 68, 31, 202, 89, 711, 362, 23, 102, 296, 28, 34, 12, 316,
56, 52, 152, 2026, 67, 167, 71, 13, 89, 10, 282, 97, 66, 80, 91, 42, 33, 586,
143, 42, 27, 172, 204, 76, 104, 241, 11, 139, 236, 488, 335, 356, 770, 40, 20,
141, 31, 78, 53, 34, 250, 142, 83, 280, 379, 82, 12, 68, 68, 119, 672, 40, 66,
83, 68, 0, 30, 61, 14, 73, 62, 112, 68, 83, 45, 284, 147, 36, 123, 74, 30, 76,
41, 37, 30, 85, 49, 39, 754, 288, 122, 54, 308, 159, 332, 123, 0, 162, 119)
trials <- 
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0)
n <- 159
input_offset <- 
c(9.03836510723637, 8.18729927015515, 10.0146263417701,
12.3820616942509, 10.7542793021776, 12.3619903347051, 9.13991790767964,
10.6760002884768, 8.15162164696975, 8.72939712269206, 9.40285975374658,
9.05975001334368, 8.91395385889425, 8.12769985281777, 9.33300038471207,
8.5173931714189, 9.25071426611446, 9.42375676753181, 9.13615547378681,
8.87038206607014, 8.15133333790043, 8.16507925880507, 8.54869185847561,
7.72973533138505, 10.023135514802, 10.3097856469482, 10.3379935294287,
8.12118324207883, 12.4730799604908, 8.04398443122155, 8.70582811026678,
8.78339623219089, 8.35208267135264, 9.13010597926558, 8.85609105525229,
9.53582388165471, 8.28248300373056, 8.07527154629746, 7.4301141385618,
9.9943788927242, 9.44888471986641, 7.82524529143177, 8.85936344915209,
8.30523682949259, 8.17526610411206, 8.77199043653224, 8.21446516075919,
7.72488843932307, 9.09211974058875, 8.59507973007331, 9.04911472347696,
11.2453858313532, 8.53405030848266, 9.53582388165471, 6.98656645940643,
8.71964411950536, 9.15429898109256, 8.92585319042092, 7.83636976054512,
10.0159229818659, 9.01942196795671, 11.3399401891533, 10.7544501182518,
7.53315880745556, 9.2762217410897, 10.403990075979, 8.37309184744198,
8.56826646160024, 7.14834574390007, 10.6746831457924, 8.72534492491121,
8.69701161799207, 9.62582181535983, 12.6084764058245, 8.66163979578127,
9.87642463298644, 9.21084024701783, 7.18992217074581, 8.94858592153432,
6.92264389147589, 10.1069180725403, 8.9380065764712, 8.74719318352693,
8.77369414638444, 9.18543273627, 8.79270146293631, 7.95577578153419,
10.8610545757221, 9.67407438820832, 8.13446757027756, 7.72577144158795,
9.79104647319038, 10.3594239506121, 9.23004495525052, 9.42714386754419,
10.3021629962849, 7.38647084882989, 9.18758338485357, 10.237420854503,
11.1245681799622, 10.4367593651319, 10.3592020770474, 11.1277187626284,
8.41759382619348, 7.63094658089046, 9.68533154273296, 7.98002359231065,
8.95763926841965, 8.90490157793514, 7.98036576511125, 10.9719498642534,
9.7834645099364, 8.94585385712759, 10.3695772824607, 10.9512275108305,
9.14761354206788, 6.97634807044775, 8.45786772533142, 8.99293035250973,
9.40079542866686, 11.0064072177905, 8.58091888229678, 8.69801362208393,
9.10886120302633, 8.61866616034687, 6.52356230614951, 8.04494704961772,
8.83797149135721, 6.96224346426621, 9.46746013884532, 9.12467354521909,
9.45250192912615, 8.70549681988774, 9.30219002560606, 8.50451313825886,
10.3919755385804, 9.38614071177987, 7.96346006663897, 9.59811661721326,
9.37033110828512, 7.568895663407, 8.91502927235991, 8.1886891244442,
8.06902932877496, 8.12266802334641, 9.04263152755007, 8.20849175174038,
7.79276172081653, 11.4389990148019, 10.7148621144607, 9.10886120302633,
8.47470313979528, 10.3123801135446, 9.5101486242258, 10.6865211398906,
9.65988615931952, 7.00488198971286, 9.90028242158718, 9.20452348665462)
has_re <- 0
n_ids <- 0
id <- 
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
center_x <- 0
W_w <- 
structure(c(1),
.Dim = c(1))
W_v <- 
structure(c(1),
.Dim = c(1))
W_u <- 
structure(c(1),
.Dim = c(1))
dw_nonzero <- 1
dwx <- 0
wx_idx <- 
structure(c(0),
.Dim = c(1))
car_rho_lims <- 
c(-1.66113364160543, 1)
Ax_w <- 
structure(c(0),
.Dim = c(1))
Ax_v <- 
structure(c(0),
.Dim = c(1))
Ax_u <- 
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0)
nAx_w <- 1
Cidx <- 
structure(c(0),
.Dim = c(1))
nC <- 1
WCAR <- 0
Delta_inv <- 
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0)
log_det_Delta_inv <- 0
n <- 159
lambda <- 
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0)
C <- 
structure(c(1),
.Dim = c(1, 1))
prior_alpha <- 
c(-4.7084373023841, 5)
dbeta_prior <- 2
prior_beta_location <- 
structure(c(0, 0),
.Dim = c(2))
prior_beta_scale <- 
structure(c(6.3033054427504, 5),
.Dim = c(2))
prior_sigma <- 
c(10, 0, 3)
prior_alpha_tau <- 
c(10, 0, 3)
prior_t_nu <- 
c(3, 0.2)
car <- 1
type <- 0
k <- 1
m <- 0
group_size <- 
structure(c(0),
.Dim = c(1))
group_idx <- 
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0)
A <- 
structure(integer(0), 
.Dim = c(159, 0))
n_edges <- 1
node1 <- 
structure(c(1),
.Dim = c(1))
node2 <- 
structure(c(1),
.Dim = c(1))
weight <- 
structure(c(1),
.Dim = c(1))
comp_id <- 
structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1),
.Dim = c(159))
inv_sqrt_scale_factor <- 
structure(c(1),
.Dim = c(1))
dev <- 0
EV <- 
structure(integer(0), 
.Dim = c(159, 0))
global_scale <- 0
slab_scale <- 0
slab_df <- 0
nImW_w <- 1
nW <- 1
ImW_w <- 
structure(c(0),
.Dim = c(1))
ImW_v <- 
structure(c(0),
.Dim = c(1))
ImW_u <- 
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0)
eigenvalues_w <- 
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0)
sar_rho_lims <- 
c(-1, 1)
Widx <- 
structure(c(0),
.Dim = c(1))
sar <- 0
dx_obs <- 2
dx_me <- 0
x_obs_idx <- 
structure(c(1, 2),
.Dim = c(2))
x_me_idx <- 
structure(c(0),
.Dim = c(1))
bounds <- 
c(-Inf, Inf)
x_obs <- 
structure(c(-0.245767799255613, -0.275409836065574, -0.0185631344049923,
0.0505909842056186, 0.147011101622545, 0.16649111542374, -0.150198010238578,
0.261212990214575, -0.203944083874189, -0.190483668341709, -0.0747101760412194,
-0.18263962318562, -0.22965076776736, -0.145443925233645, -0.0974332560734827,
-0.0714158186038207, -0.0715085884988798, 0.244634537539143, -0.136692071661883,
-0.191296222133227, -0.230151374729688, -0.22667077302125, -0.230816704381814,
-0.265866209262436, -0.152558064645977, -0.206124004743351, -0.207993099482461,
-0.201804511278195, 0.103500228592012, -0.199940493900625, -0.287562794945958,
-0.212100518983884, -0.145466696368902, -0.095255212077642, -0.151875682894258,
-0.189020424092624, -0.250837844805362, -0.167817472230561, -0.323658269441402,
-0.134233749016033, -0.199818156385508, -0.187432675044883, -0.235248245386015,
-0.197696737044146, -0.290298873101421, -0.148516492623902, -0.23071104387292,
-0.204089360090875, 0.0812765468947308, -0.214984758543238, -0.222576390415476,
0.162784736382173, -0.310721164134389, -0.241719389653889, -0.259781911481719,
-0.0907742998352554, -0.146493451626531, -0.106369743717343, -0.268607343698313,
-0.017535314174379, -0.168988269794721, -0.118326242662502,
-0.00427456987140669, -0.31138694009714, -0.00969091094562889,
-0.0330111643597226, -0.178674351585014, -0.134067230194614, -0.360232945091514,
0.0174399607907205, -0.145085567166439, -0.223464566929134, -0.118414256198347,
0.0969111235550578, -0.266357639507934, -0.173140419217214, -0.0450047573739296,
-0.195667870036101, -0.0861836459482653, -0.305139186295503, -0.132832860087907,
-0.247259294566254, -0.1736007183478, -0.242078001218769, 0.0777936055713833,
-0.126009446899284, -0.271406727828746, -0.171901396310981, -0.105636237897649,
-0.279839518555667, -0.401678657074341, -0.11402384941362, 0.0046525343206317,
-0.138699007717751, 0.0191706781521831, -0.0790167300169242, -0.212040490143847,
-0.197373578988632, 0.00947547618282851, 0.0664941890390919,
-0.0616767922235723, -0.0999635169646115, -0.171288020508557,
-0.149675528574419, -0.341249354672173, -0.215445498457778, -0.163869693978282,
-0.204368752313958, -0.0359794403198173, -0.304781460838956, 0.316294536817102,
0.0434379423105081, -0.223841059602649, -0.0373627024306481, 0.0389169573446372,
-0.176664337758259, -0.199095022624434, -0.204933586337761, -0.220831799779168,
-0.118954619700305, -0.121880313751303, -0.116705212595624, -0.0129380936783492,
-0.038337182448037, -0.195739014647137, -0.217320261437909, -0.211135213304411,
0.0317007211538462, -0.0870588235294118, 0.112189504852772, 0.0588178481746185,
-0.145039181830256, -0.170673076923077, -0.0736969278564032, -0.167780892818633,
-0.0539234423633484, -0.20063304798216, -0.272865390458827, -0.107864429088516,
-0.106490775260491, -0.19695652173913, -0.213842058562555, -0.239524909270868,
-0.24812030075188, -0.242944428280477, -0.149939139094832, -0.16942961506041,
-0.227551803530315, -0.0164307311074331, 0.0828135963202619, -0.226140057125973,
-0.245791928614885, -0.171031824471239, -0.141229764839118, 0.0724197827788276,
0.00626067159931702, -0.229791099000908, 0.0297267858763729, -0.211855757781936,
13.7, 14.1, 17.6, 43.4, 35.1, 46.5, 12.9, 46.5, 15.5, 17.1, 20, 15.8, 14, 13.5,
26.2, 15.5, 18, 51.1, 19.4, 10.8, 10.6, 12.3, 11.3, 13.4, 18.5, 42.7, 21.4,
14.4, 36.1, 10.4, 12, 11.8, 9.8, 14, 13.2, 12.5, 12.6, 13.1, 11.2, 16.4, 13.2,
9.9, 13.7, 17.2, 15.6, 15.6, 10.1, 13.6, 30.4, 15.5, 9.8, 37, 8.6, 20.9, 8.8,
13.9, 22.1, 10.4, 12.5, 20.8, 12.6, 19.5, 27.3, 9.4, 26.3, 19.5, 12.4, 10.8,
7.9, 27.1, 12.8, 15.2, 18.3, 51.4, 11, 27.4, 20.1, 12.3, 11.4, 9.1, 15.9, 12.4,
9.7, 8.2, 32.6, 24.8, 11.7, 25.7, 23.1, 8.8, 11.1, 14.4, 26.5, 22.4, 23.7, 15.7,
12.9, 13.7, 19.9, 28.3, 20.6, 20.4, 21.3, 26.2, 12.8, 15.6, 14.1, 13.7, 25.8,
9.3, 51.7, 20.1, 13.5, 29.6, 24, 15.1, 9, 10, 11.5, 9.4, 26.2, 16.9, 15.9, 22.2,
14.2, 7, 12, 20.8, 33.4, 29.9, 25.6, 16.5, 11.9, 21.4, 10.3, 19.6, 13.9, 14.3,
18.7, 21.3, 12.3, 11.1, 9.4, 16.4, 11.2, 14.1, 10.5, 11.4, 33.2, 29.8, 14.6,
8.4, 25.6, 12.2, 24.1, 24.5, 11.7, 21, 18.6),
.Dim = c(159, 2))
x_me <- 
structure(integer(0), 
.Dim = c(0, 159))
sigma_me <- 
structure(integer(0), 
.Dim = c(0, 159))
ME_prior_car_rho <- 
c(0, 0)
has_me <- 0
spatial_me <- 0
use_logit <- 
structure(integer(0), 
.Dim = c(0))
nC <- 1
nAx_w <- 1
C <- 
structure(c(1),
.Dim = c(1, 1))
Delta_inv <- 
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0)
log_det_Delta_inv <- 0
Ax_w <- 
structure(c(0),
.Dim = c(1))
Ax_v <- 
structure(c(0),
.Dim = c(1))
Ax_u <- 
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0)
Cidx <- 
structure(c(0),
.Dim = c(1))
lambda <- 
c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0)
WCAR <- 0
prior_mux_true_location <- integer(0)
prior_mux_true_scale <- integer(0)
prior_sigmax_true_df <- integer(0)
prior_sigmax_true_location <- integer(0)
prior_sigmax_true_scale <- integer(0)
prior_nux_true_alpha <- integer(0)
prior_nux_true_beta <- integer(0)
prior_rhox_true <- 
c(-1, 1)
spatial_me <- 0

Thanks for tracking it down to that line of code and sharing data.

How was that data created? Is this what was created automatically in the test? If so, I think it means that prep_car_data is acting differently there than on my computer (and elsewhere it seems).

In that data, WCAR = 0, and that will cause car_normal_lpdf to run instead of wcar_normal_lpdf. So then it needs an array of index positionsCidx, but in your data Cidx=array(0) (which is what happens by default when WCAR=1 but not otherwise).

The test that's failing uses this code to prep the data:

>   data(georgia)
    A <- shape2mat(georgia)
    cars <- prep_car_data(A) 
Range of permissible rho values:  -1.661134 1 
> cars$WCAR
[1] 1

and this output that I'm getting is how I expect it to look (and so the test works).


The call to car_normal_lpdf is inside a conditional statement, wrapped in this auto_normal_lpdf function:

real auto_normal_lpdf(vector y, vector mu,
		      real tau, real rho,
		      vector Ax_w, array[] int Ax_v, array[] int Ax_u,
		      array[] int Cidx,
		      vector D_inv, real log_det_D_inv,
		      vector lambda,
		      int n, int WCAR) {
  if (WCAR) {
    return wcar_normal_lpdf(y | mu, tau, rho, Ax_w, Ax_v, Ax_u, D_inv, log_det_D_inv, lambda, n);
  } else {
    return car_normal_lpdf(y | mu, tau, rho, Ax_w, Ax_v, Ax_u, Cidx, D_inv, log_det_D_inv, lambda, n);
      }
}

I made the data file by stepping into stan_car until it got to the point where it called rstan::sampling and then I assigned standata into R's global environment and called rstan::stan_rdump. I was perplexed that it was happening on CRAN and my laptop but not with the GitHub server or my Ubuntu server in my office where I tested all the packages that have StanHeaders in their LinkingTo.

If I just do (on my laptop, where it is failing)

packageVersion("geostan") # 0.5.2
data(georgia)
A <- shape2mat(georgia)
cars <- prep_car_data(A)
str(cars)

I get

List of 13
 $ Ax_w             : num [1:860] 1 1 1 1 1 1 1 1 1 1 ...
 $ Ax_v             : int [1:860] 23 58 59 131 148 159 9 12 35 76 ...
 $ Ax_u             : int [1:160] 1 7 12 18 23 26 31 38 42 47 ...
 $ nAx_w            : int 860
 $ Cidx             : num [1(1d)] 0
 $ nC               : num 1
 $ WCAR             : num 1
 $ Delta_inv        : num [1:159] 6 5 6 5 3 5 7 4 5 5 ...
 $ style            : chr "WCAR"
 $ log_det_Delta_inv: num 261
  ..- attr(*, "logarithm")= logi TRUE
 $ n                : int 159
 $ lambda           : num [1:159] -0.602 -0.564 -0.55 -0.548 -0.545 ...
 $ C                :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  .. ..@ i       : int [1:860] 22 57 58 130 147 158 8 11 34 75 ...
  .. ..@ p       : int [1:160] 0 6 11 17 22 25 30 37 41 46 ...
  .. ..@ Dim     : int [1:2] 159 159
  .. ..@ Dimnames:List of 2
  .. .. ..$ : NULL
  .. .. ..$ : NULL
  .. ..@ x       : num [1:860] 0.167 0.143 0.167 0.2 0.143 ...
  .. ..@ factors : list()

So, I would agree it is presumably an issue with that function.

When I do it on the Ubuntu server, I get the same cars but it somehow runs with StanHeaders 2.26.x (which is presumably a bug).

Oh! That list looks correct:

$ Cidx             : num [1(1d)] 0 # a placeholder because wcar_normal_lpdf doesn't need Cidx
 $ nC               : num 1
 $ WCAR             : num 1  ## this means it should use wcar_normal_lpdf instead of car_normal_lpdf

Since WCAR=1 the car_normal_lpdf shouldn't be called, so I don't know how it could fail.

I haven't tried myself with StanHeaders 2.32.x yet but I can start working on it this afternoon, its definitely a priority.

I think I figured out what the problem is. The prep_car_data function returns a list where $WCAR is 1, in which case $Cidx should be an array of size zero. But inside the stan_car function, it creates standata, appends car_parts to it (with $WCAR as 1), and then eventually does

me.list <- make_me_data(ME, xraw)
standata <- c(standata, me.list)

where me.list also has a $WCAR element that is 0. Thus, the latter is what is used when everything is passed to the data block of the Stan program.

I've got one or two other problems to deal with but what you said should be fine.

When I build it with the new StanHeaders (that you linked to) it still segfaults.

Here's what I've done (basically):

  • installed rstan 2.32
  • removed all duplicate items in the list of data being passed to Stan, and created a new ME_WCAR variable for the measurement error models, then rebuilt the package. [Actually I'm going to have to change the way I fixed it---as is it could cause errors for an unusual case, but I don't think its causing any issues in these tests.]
    • when a list is passed to Stan with duplicate names, it accepts the first one (by index) and ignores the others, at least based on one test I just did. That explains why it never threw an error, but still don't know why it does now.
  • built it and ran devtools::test() and devtools::check() and didn't get any errors
  • installed StanHeaders 2.32 (using the link to StanHeaders you provided)
  • My ~/.R/Makevars was like this:
CXX14FLAGS=-O0 -march=native -mtune=native -fPIC 
CXX14=g++
  • ran devtools::check() which I think builds it again with the new StanHeaders, and it fails on (at least) one of the tests.

Next time I can sit down with this (tomorrow) I will look into the error more closely.

(I pushed all the changes to the dev branch)

The problem seems to come from the model for missing/censored outcome data, although I haven't seen any other indication yet that there's something wrong with this model.

Compiling with StanHeaders 2.32, it will break/sometimes segfault with this one (in addition to the case you identified):

devtools::load_all("~/dev/geostan")

fit <- stan_glm(deaths.female ~ offset(log(pop.at.risk.female)),
                censor_point = 9,
                data = georgia,
                family = poisson()
)

I haven't been able to create any segfaults with geostan from GitHub.

Is that using the same StanHeaders 2.32 that you shared with me earlier, and my dev branch?

I can update geostan with something similar to the current dev branch, though I'm somewhat concerned that using the new StanHeaders doesn't work on my computer

Yeah. Can you follow https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Debugging-compiled-code on the computer where it is not working? Also, you probably need to recompile geostan without optimization.

I checked that its segfaulting after recompiling without optimization (it is)

Using

$ R -d gdb --vanilla
...
gdb> run

and then in the R session:

devtools::load_all('~/dev/geostan')
fit <- stan_glm(deaths.female ~ offset(log(pop.at.risk.female)),
                censor_point = 9,
                data = georgia,
                family = poisson()
)
...
SAMPLING FOR MODEL 'foundation' NOW (CHAIN 1).

Thread 1 "R" received signal SIGSEGV, Segmentation fault.
Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>::rows() const (this=0x7ffffffdb5f0) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
69	    Index rows() const { return m_xpr.rows(); }
(gdb) 

It ends with at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69

There aren't any more duplicated variables defined in R. This is using the dev2 branch that I just pushed

If you enter bt at the (gdb) prompt at that point, it will given you something like traceback() in R, which would help figure out where it is trying to calculate the number of rows of something that does not exist.

Thanks. Here's what I've found so far.

Are you ready to submit to cran and waiting for this to be fixed still? Just want to be clear; I had a deadline to meet last week but this week will be able to respond much more quickly if needed.

The first line of code from geostan that appears in the traceback is here (this is the line that's unique to the censor_point argument):

  target += poisson_lpmf(y_int[y_obs_idx] | fitted[y_obs_idx]);
   if (censor_point > 0) target += poisson_lcdf(censor_point | fitted[y_mis_idx]); # right here

where fitted is declared as a transformed parameter

  vector[n] fitted;
  if (!car) fitted = input_offset + intercept;  # car=0
  if (is_poisson) fitted = exp(fitted);  

This model for censored observations also has a function for initial values, but the model segfaults whether the inits function is used or not (in this case it initiates the intercept at values near -4.7)

I pulled out the data just before it gets passed to Stan, and don't see anything that I would expect to cause an error.

> x$censor_point
[1] 9
> x$y_mis_idx
[1]  55 126 157
> x$car
[1] 0
> x$input_offset[x$y_mis_idx]
[1] 6.986566 6.523562 7.004882

Is there something wrong with my using a single integer for censor_point with a vector for the second argument to poisson_lcdf? It seems like I should be looking for something that could possibly run without causing an error, but really shouldn't be allowed (by Stan's syntax?). The models return reasonable results on the current version.

# flagged line 3857, StanExports_foundation.h 
 if (is_poisson) {
            current_statement__ = 176;
            lp_accum__.add(stan::math::poisson_lpmf<false>(
                             stan::model::rvalue(y_int, "y_int",
                               stan::model::index_multi(y_obs_idx)),
                             stan::model::rvalue(fitted, "fitted",
                               stan::model::index_multi(y_obs_idx))));
            current_statement__ = 178;
  if (stan::math::logical_gt(censor_point, 0)) {
              current_statement__ = 177;
[3857]        lp_accum__.add(stan::math::poisson_lcdf(censor_point,
                               stan::model::rvalue(fitted, "fitted",
                                 stan::model::index_multi(y_mis_idx))));
            }
          }

no. 8 is StanExports_foundation.h

(gdb) bt
#0  Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>::rows() const (
    this=0x7ffffffdb5f0)
--Type <RET> for more, q to quit, c to continue without paging--
    at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
#1  stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const--Type <RET> for more, q to quit, c to continue without paging--
::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}>::rows() const (this=0x7ffffffdb5f0)
    at /home/connor/R-packages/StanHeaders/include/stan/math/prim/meta/holder.hpp:132
#2  Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<dou--Type <RET> for more, q to quit, c to continue without paging--
ble, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const>::rows() const (this=<optimized out>)
    at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
#3  Eigen::EigenBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*--Type <RET> for more, q to quit, c to continue without paging--
)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::rows() const (this=<optimized out>)
    at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/EigenBase.h:59
#4  Eigen::EigenBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>,--Type <RET> for more, q to quit, c to continue without paging--
 stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double cons--Type <RET> for more, q to quit, c to continue without paging--
t&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::size() const (this=<optimized out>)
    at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/EigenBase.h:66
#5  Eigen::DenseBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Ei--Type <RET> for more, q to quit, c to continue without paging--
gen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::sum() const (this=<optimized out>)
    at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/Redux.h:451
#6  _ZN4stan4math3sumIN5Eigen12CwiseUnaryOpINS2_8internal13scalar_log_opIdEEKNS0_6HolderINS3_IZZNS0_19apply_scalar_binaryIRKdRKNS2_5ArrayIdLin1ELi1ELi0ELin1ELi1EEEZNS0_7gamma_qIdSC_LPv0EEEDaRKT_RKT0_EUlSJ_SM_E_LSG_0ELSG_0EEEDaOSH_OSK_OT1_ENKUlRSH_RSK_RSQ_E_clISN_S9_SD_EEDaSS_ST_SU_EUlSJ_E_SD_EEJSN_EEEEELSG_0EEENS_10value_typeISH_vE4typeESJ_ (m=...)
    at /home/connor/R-packages/StanHeaders/include/stan/math/prim/fun/sum.hpp:47
#7  stan::math::poisson_lcdf<int, Eigen::CwiseNullaryOp<stan::model::rvalue<Eigen::Matrix<double, -1, 1, 0, -1, 1>&, (void*)0>(Eigen::Matrix<double, -1, 1, 0, ---Type <RET> for more, q to quit, c to continue without paging--
1, 1>&, char const*, stan::model::index_multi const&)::{lambda(auto:1&)#1}::operator()<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::Matrix<double, -1, 1, 0, -1, 1>&) const::{lambda(long)#1}, Eigen::Matrix<double, -1, 1, 0, -1, 1> > >(int const&, Eigen::CwiseNullaryOp<stan::model::rvalue<Eigen::Matrix<double, -1, 1, 0, -1, 1>&, (void*)0>(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, char const*, stan::model::index_multi const&)::{lambda(auto:1&)#1}::operator()<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::Matrix<double, -1, 1, 0, -1, 1>&) const::{lambda(long)#1}, Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&) (lambda=..., 
    n=<optimized out>, n=<optimized out>)
    at /home/connor/R-packages/StanHeaders/include/stan/math/prim/prob/poisson_lcdf.hpp:57
#8  0x00007fffe1bc163e in model_foundation_namespace::model_foundation::log_prob_impl<false, true, std::vector<double, std::allocator<double> >, std::vector<int, std::allocator<int> >, (void*)0, (void*)0> (this=this@entry=0x5555678dd990, 
    params_r__=std::vector of length 1, capacity 1 = {...}, 

    params_i__=std::vector of length 0, capacity 0, 
--Type <RET> for more, q to quit, c to continue without paging--
    pstream__=pstream__@entry=0x7ffffffdc260)
    at /home/connor/dev/geostan/src/stanExports_foundation.h:3857

#9  0x00007fffe1bf27d5 in model_foundation_namespace::model_foundation::log_prob<false, true, double> (pstream=0x7ffffffdc260, 
    params_i=std::vector of length 0, capacity 0, 
    params_r=std::vector of length 1, capacity 1 = {...}, this=0x5555678dd990)
    at /home/connor/dev/geostan/src/stanExports_foundation.h:5849
#10 stan::services::util::initialize<true, model_foundation_namespace::model_foundation, stan::io::var_context, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > > (

    model=..., init=..., rng=..., init_radius=init_radius@entry=2, 
    print_timing=print_timing@entry=true, logger=..., init_writer=...)
    at /home/connor/R-packages/StanHeaders/include/src/stan/services/util/initialize.hpp:129
#11 0x00007fffe1bfd957 in stan::services::sample::hmc_nuts_diag_e_adapt<model_fo--Type <RET> for more, q to quit, c to continue without paging--
undation_namespace::model_foundation> (model=..., init=..., 
    init_inv_metric=..., random_seed=random_seed@entry=167159160, 
    chain=chain@entry=1, init_radius=init_radius@entry=2, 
    num_warmup=num_warmup@entry=1000, num_samples=1000, num_thin=1, 
    save_warmup=true, refresh=1000, stepsize=stepsize@entry=1, 
    stepsize_jitter=stepsize_jitter@entry=0, max_depth=10, 
    delta=delta@entry=0.80000000000000004, 
    gamma=gamma@entry=0.050000000000000003, kappa=kappa@entry=0.75, 
    t0=t0@entry=10, init_buffer=75, term_buffer=50, window=25, interrupt=..., 
    logger=..., init_writer=..., sample_writer=..., diagnostic_writer=...)
    at /home/connor/R-packages/StanHeaders/include/src/stan/services/sample/hmc_nuts_diag_e_adapt.hpp:73
#12 0x00007fffe1c1b75f in stan::services::sample::hmc_nuts_diag_e_adapt<model_foundation_namespace::model_foundation> (diagnostic_writer=..., 
    sample_writer=..., init_writer=..., logger=..., interrupt=..., 
    window=<optimized out>, term_buffer=<optimized out>, 
--Type <RET> for more, q to quit, c to continue without paging--
    init_buffer=<optimized out>, t0=<optimized out>, kappa=<optimized out>, 
    gamma=<optimized out>, delta=<optimized out>, max_depth=10, 
    stepsize_jitter=0, stepsize=1, refresh=<optimized out>, 
    save_warmup=<optimized out>, num_thin=1, num_samples=1000, 
    num_warmup=1000, init_radius=2, chain=1, random_seed=167159160, init=..., 
    model=...)
    at /home/connor/R-packages/StanHeaders/include/src/stan/services/sample/hmc_nuts_diag_e_adapt.hpp:151
#13 rstan::(anonymous namespace)::command<model_foundation_namespace::model_foundation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > > (args=..., model=..., 
    holder=..., qoi_idx=std::vector of length 320, capacity 512 = {...}, 
    fnames_oi=std::vector of length 320, capacity 320 = {...}, base_rng=...)
    at /home/connor/R-packages/rstan/include/rstan/stan_fit.hpp:668
#14 0x00007fffe1c1cdd3 in rstan::stan_fit<model_foundation_namespace::model_foun--Type <RET> for more, q to quit, c to continue without paging--
dation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > >::call_sampler (
    this=0x5555678dd8b0, args_=<optimized out>)
    at /home/connor/R-packages/Rcpp/include/Rcpp/vector/Vector.h:616
#15 0x00007fffe1b08530 in Rcpp::class_<rstan::stan_fit<model_foundation_namespace::model_foundation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > > >::invoke_notvoid (this=<optimized out>, method_xp=<optimized out>, object=0x555564f5ce40, 
    args=0x7ffffffde2f0, nargs=<optimized out>)
    at /home/connor/R-packages/Rcpp/include/Rcpp/module/class.h:234
#16 0x00007ffff2e69ff2 in CppMethod__invoke_notvoid (args=<optimized out>)
    at module.cpp:220
#17 0x00007ffff7c506fb in ?? () from /usr/lib/R/lib/libR.so
#18 0x00007ffff7caa340 in Rf_eval () from /usr/lib/R/lib/libR.so
--Type <RET> for more, q to quit, c to continue without paging--
#19 0x00007ffff7cad378 in ?? () from /usr/lib/R/lib/libR.so
#20 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#21 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#22 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#23 0x00007ffff7ca9e1c in Rf_eval () from /usr/lib/R/lib/libR.so
#24 0x00007ffff7caa6a4 in ?? () from /usr/lib/R/lib/libR.so
#25 0x00007ffff7caa988 in ?? () from /usr/lib/R/lib/libR.so
#26 0x00007ffff7c95d32 in ?? () from /usr/lib/R/lib/libR.so
#27 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#28 0x00007ffff7caa6a4 in ?? () from /usr/lib/R/lib/libR.so
#29 0x00007ffff7caa988 in ?? () from /usr/lib/R/lib/libR.so
#30 0x00007ffff7c95d32 in ?? () from /usr/lib/R/lib/libR.so
#31 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#32 0x00007ffff7caa6a4 in ?? () from /usr/lib/R/lib/libR.so
#33 0x00007ffff7caa988 in ?? () from /usr/lib/R/lib/libR.so
#34 0x00007ffff7c95d32 in ?? () from /usr/lib/R/lib/libR.so
--Type <RET> for more, q to quit, c to continue without paging--
#35 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#36 0x00007ffff7caa6a4 in ?? () from /usr/lib/R/lib/libR.so
#37 0x00007ffff7caa988 in ?? () from /usr/lib/R/lib/libR.so
#38 0x00007ffff7c95d32 in ?? () from /usr/lib/R/lib/libR.so
#39 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#40 0x00007ffff7caa6a4 in ?? () from /usr/lib/R/lib/libR.so
#41 0x00007ffff7caa988 in ?? () from /usr/lib/R/lib/libR.so
#42 0x00007ffff7c95d32 in ?? () from /usr/lib/R/lib/libR.so
#43 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#44 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#45 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#46 0x00007ffff7c9aced in ?? () from /usr/lib/R/lib/libR.so
#47 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#48 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#49 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#50 0x00007ffff7c9aced in ?? () from /usr/lib/R/lib/libR.so
--Type <RET> for more, q to quit, c to continue without paging--
#51 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#52 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#53 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#54 0x00007ffff7c9aced in ?? () from /usr/lib/R/lib/libR.so
#55 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#56 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#57 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#58 0x00007ffff7c9aced in ?? () from /usr/lib/R/lib/libR.so
#59 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#60 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#61 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#62 0x00007ffff7ca9e1c in Rf_eval () from /usr/lib/R/lib/libR.so
#63 0x00007ffff7cae892 in ?? () from /usr/lib/R/lib/libR.so
#64 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#65 0x00007ffff7cad378 in ?? () from /usr/lib/R/lib/libR.so
#66 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
--Type <RET> for more, q to quit, c to continue without paging--
#67 0x00007ffff7cb1530 in ?? () from /usr/lib/R/lib/libR.so
#68 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#69 0x00007ffff7cad378 in ?? () from /usr/lib/R/lib/libR.so
#70 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#71 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#72 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#73 0x00007ffff7c9aced in ?? () from /usr/lib/R/lib/libR.so
#74 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#75 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#76 0x00007ffff7cacee9 in R_execMethod () from /usr/lib/R/lib/libR.so
#77 0x00007ffff44d1940 in ?? () from /usr/lib/R/library/methods/libs/methods.so
#78 0x00007ffff7cf4869 in ?? () from /usr/lib/R/lib/libR.so
#79 0x00007ffff7c9c0e5 in ?? () from /usr/lib/R/lib/libR.so
#80 0x00007ffff7ca9cf0 in Rf_eval () from /usr/lib/R/lib/libR.so
#81 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#82 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
--Type <RET> for more, q to quit, c to continue without paging--
#83 0x00007ffff7ca9e1c in Rf_eval () from /usr/lib/R/lib/libR.so
#84 0x00007ffff7cae892 in ?? () from /usr/lib/R/lib/libR.so
#85 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#86 0x00007ffff7cad378 in ?? () from /usr/lib/R/lib/libR.so
#87 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#88 0x00007ffff7cabd86 in ?? () from /usr/lib/R/lib/libR.so
#89 0x00007ffff7cacbb5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#90 0x00007ffff7ca9e1c in Rf_eval () from /usr/lib/R/lib/libR.so
#91 0x00007ffff7cae892 in ?? () from /usr/lib/R/lib/libR.so
#92 0x00007ffff7caa100 in Rf_eval () from /usr/lib/R/lib/libR.so
#93 0x00007ffff7cdfd0a in Rf_ReplIteration () from /usr/lib/R/lib/libR.so
#94 0x00007ffff7ce00a0 in ?? () from /usr/lib/R/lib/libR.so
#95 0x00007ffff7ce0160 in run_Rmainloop () from /usr/lib/R/lib/libR.so
#96 0x000055555555509f in main ()
#97 0x00007ffff7958d90 in __libc_start_call_main (
    main=main@entry=0x555555555080 <main>, argc=argc@entry=2, 
--Type <RET> for more, q to quit, c to continue without paging--
    argv=argv@entry=0x7fffffffdf98)
    at ../sysdeps/nptl/libc_start_call_main.h:58
#98 0x00007ffff7958e40 in __libc_start_main_impl (main=0x555555555080 <main>, 
    argc=2, argv=0x7fffffffdf98, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffdf88)
    at ../csu/libc-start.c:392
#99 0x00005555555550d5 in _start ()

Can you install rstantools from GitHub locally, except remove the -DEIGEN_NO_DEBUG from line 4 of

rstantools/inst/include/sys/Makevars

Then, recompile geostan with debug symbols but without optimization and run it under gdb again to see if we can get Eigen to tell us more about what is going wrong.

I set my ~/.R/Makevars like this

CXX14FLAGS=-00 -march=native -mtune=native -fPIC -g
CXX14=g++

Its not looking any different for me.

Sorry I can't be of more help here.

Would it make sense to debug this after StanHeaders is updated on CRAN? I.e., I submit a new version of geostan (dev2) that allows StanHeaders to update on CRAN [you're saying my dev branch seems to work?], and then figure out this issue? I can't tell how serious this issue might be from your perspective @bgoodri @jgabry

Thread 1 "R" received signal SIGSEGV, Segmentation fault.
Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>::rows() const (this=0x7ffffffdbac0) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
69	    Index rows() const { return m_xpr.rows(); }
(gdb) bt
#0  Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>::rows() const (this=0x7ffffffdbac0)
    at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
#1  stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double c--Type <RET> for more, q to quit, c to continue without paging--c
onst&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}>::rows() const (this=0x7ffffffdbac0) at /home/connor/R-packages/StanHeaders/include/stan/math/prim/meta/holder.hpp:132
#2  Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const>::rows() const (this=<optimized out>) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/CwiseUnaryOp.h:69
#3  Eigen::EigenBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::rows() const (this=<optimized out>) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/EigenBase.h:59
#4  Eigen::EigenBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::size() const (this=<optimized out>) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/EigenBase.h:66
#5  Eigen::DenseBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_log_op<double>, stan::math::Holder<Eigen::CwiseUnaryOp<stan::math::apply_scalar_binary<double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, (void*)0, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&&)::{lambda(auto:1&, auto:2&, auto:3&)#1}::operator()<stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}, double const, Eigen::Array<double, -1, 1, 0, -1, 1> const>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}&) const::{lambda(auto:1 const&)#1}, Eigen::Array<double, -1, 1, 0, -1, 1> const>, stan::math::gamma_q<double, Eigen::Array<double, -1, 1, 0, -1, 1>, (void*)0>(double const&, Eigen::Array<double, -1, 1, 0, -1, 1> const&)::{lambda(auto:1 const&, auto:2 const&)#1}> const> >::sum() const (this=<optimized out>) at /home/connor/R-packages/RcppEigen/include/Eigen/src/Core/Redux.h:451
#6  _ZN4stan4math3sumIN5Eigen12CwiseUnaryOpINS2_8internal13scalar_log_opIdEEKNS0_6HolderINS3_IZZNS0_19apply_scalar_binaryIRKdRKNS2_5ArrayIdLin1ELi1ELi0ELin1ELi1EEEZNS0_7gamma_qIdSC_LPv0EEEDaRKT_RKT0_EUlSJ_SM_E_LSG_0ELSG_0EEEDaOSH_OSK_OT1_ENKUlRSH_RSK_RSQ_E_clISN_S9_SD_EEDaSS_ST_SU_EUlSJ_E_SD_EEJSN_EEEEELSG_0EEENS_10value_typeISH_vE4typeESJ_ (m=...) at /home/connor/R-packages/StanHeaders/include/stan/math/prim/fun/sum.hpp:47
#7  stan::math::poisson_lcdf<int, Eigen::CwiseNullaryOp<stan::model::rvalue<Eigen::Matrix<double, -1, 1, 0, -1, 1>&, (void*)0>(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, char const*, stan::model::index_multi const&)::{lambda(auto:1&)#1}::operator()<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::Matrix<double, -1, 1, 0, -1, 1>&) const::{lambda(long)#1}, Eigen::Matrix<double, -1, 1, 0, -1, 1> > >(int const&, Eigen::CwiseNullaryOp<stan::model::rvalue<Eigen::Matrix<double, -1, 1, 0, -1, 1>&, (void*)0>(Eigen::Matrix<double, -1, 1, 0, -1, 1>&, char const*, stan::model::index_multi const&)::{lambda(auto:1&)#1}::operator()<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::Matrix<double, -1, 1, 0, -1, 1>&) const::{lambda(long)#1}, Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&) (lambda=..., n=<optimized out>, n=<optimized out>) at /home/connor/R-packages/StanHeaders/include/stan/math/prim/prob/poisson_lcdf.hpp:57
#8  0x00007fffe1bc8bd5 in model_foundation_namespace::model_foundation::log_prob_impl<false, true, std::vector<double, std::allocator<double> >, std::vector<int, std::allocator<int> >, (void*)0, (void*)0> (this=this@entry=0x55555f33c9c0, params_r__=std::vector of length 1, capacity 1 = {...}, params_i__=std::vector of length 0, capacity 0, pstream__=pstream__@entry=0x7ffffffdc830) at /home/connor/dev/geostan/src/stanExports_foundation.h:3857
#9  0x00007fffe1bd37ca in model_foundation_namespace::model_foundation::log_prob<false, true, double> (pstream=0x7ffffffdc830, params_i=std::vector of length 0, capacity 0, params_r=std::vector of length 1, capacity 1 = {...}, this=0x55555f33c9c0) at /home/connor/dev/geostan/src/stanExports_foundation.h:5847
#10 stan::services::util::initialize<true, model_foundation_namespace::model_foundation, stan::io::var_context, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > > (model=..., init=..., rng=..., init_radius=init_radius@entry=2, print_timing=print_timing@entry=true, logger=..., init_writer=...) at /home/connor/R-packages/StanHeaders/include/src/stan/services/util/initialize.hpp:129
#11 0x00007fffe1bfd279 in stan::services::sample::hmc_nuts_diag_e_adapt<model_foundation_namespace::model_foundation> (model=..., init=..., init_inv_metric=..., random_seed=random_seed@entry=559171561, chain=chain@entry=1, init_radius=init_radius@entry=2, num_warmup=num_warmup@entry=1000, num_samples=1000, num_thin=1, save_warmup=true, refresh=1000, stepsize=stepsize@entry=1, stepsize_jitter=stepsize_jitter@entry=0, max_depth=10, delta=delta@entry=0.80000000000000004, gamma=gamma@entry=0.050000000000000003, kappa=kappa@entry=0.75, t0=t0@entry=10, init_buffer=75, term_buffer=50, window=25, interrupt=..., logger=..., init_writer=..., sample_writer=..., diagnostic_writer=...) at /home/connor/R-packages/StanHeaders/include/src/stan/services/sample/hmc_nuts_diag_e_adapt.hpp:73
#12 0x00007fffe1c1e096 in stan::services::sample::hmc_nuts_diag_e_adapt<model_foundation_namespace::model_foundation> (diagnostic_writer=..., sample_writer=..., init_writer=..., logger=..., interrupt=..., window=<optimized out>, term_buffer=<optimized out>, init_buffer=<optimized out>, t0=<optimized out>, kappa=<optimized out>, gamma=<optimized out>, delta=<optimized out>, max_depth=10, stepsize_jitter=0, stepsize=1, refresh=1000, save_warmup=<optimized out>, num_thin=1, num_samples=1000, num_warmup=1000, init_radius=2, chain=1, random_seed=559171561, init=..., model=...) at /home/connor/R-packages/StanHeaders/include/src/stan/services/sample/hmc_nuts_diag_e_adapt.hpp:151
#13 rstan::(anonymous namespace)::command<model_foundation_namespace::model_foundation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > > (args=..., model=..., holder=..., qoi_idx=std::vector of length 320, capacity 512 = {...}, fnames_oi=std::vector of length 320, capacity 320 = {...}, base_rng=...) at /home/connor/R-packages/rstan/include/rstan/stan_fit.hpp:668
#14 0x00007fffe1c1f2ac in rstan::stan_fit<model_foundation_namespace::model_foundation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > >::call_sampler (this=0x55555f33c8e0, args_=0x55556056a5c8) at /home/connor/R-packages/Rcpp/include/Rcpp/vector/Vector.h:616
#15 0x00007fffe1b4c2cc in Rcpp::class_<rstan::stan_fit<model_foundation_namespace::model_foundation, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014u, 0u, 2147483563u>, boost::random::linear_congruential_engine<unsigned int, 40692u, 0u, 2147483399u> > > >::invoke_notvoid (this=<optimized out>, method_xp=<optimized out>, object=0x5555643642d0, args=0x7ffffffde300, nargs=<optimized out>) at /home/connor/R-packages/Rcpp/include/Rcpp/module/class.h:234
#16 0x00007ffff2e67ff2 in CppMethod__invoke_notvoid (args=<optimized out>) at module.cpp:220
#17 0x00007ffff7c5070b in ?? () from /usr/lib/R/lib/libR.so
#18 0x00007ffff7caa350 in Rf_eval () from /usr/lib/R/lib/libR.so
#19 0x00007ffff7cad388 in ?? () from /usr/lib/R/lib/libR.so
#20 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#21 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#22 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#23 0x00007ffff7ca9e2c in Rf_eval () from /usr/lib/R/lib/libR.so
#24 0x00007ffff7caa6b4 in ?? () from /usr/lib/R/lib/libR.so
#25 0x00007ffff7caa998 in ?? () from /usr/lib/R/lib/libR.so
#26 0x00007ffff7c95d42 in ?? () from /usr/lib/R/lib/libR.so
#27 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#28 0x00007ffff7caa6b4 in ?? () from /usr/lib/R/lib/libR.so
#29 0x00007ffff7caa998 in ?? () from /usr/lib/R/lib/libR.so
#30 0x00007ffff7c95d42 in ?? () from /usr/lib/R/lib/libR.so
#31 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#32 0x00007ffff7caa6b4 in ?? () from /usr/lib/R/lib/libR.so
#33 0x00007ffff7caa998 in ?? () from /usr/lib/R/lib/libR.so
#34 0x00007ffff7c95d42 in ?? () from /usr/lib/R/lib/libR.so
#35 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#36 0x00007ffff7caa6b4 in ?? () from /usr/lib/R/lib/libR.so
#37 0x00007ffff7caa998 in ?? () from /usr/lib/R/lib/libR.so
#38 0x00007ffff7c95d42 in ?? () from /usr/lib/R/lib/libR.so
#39 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#40 0x00007ffff7caa6b4 in ?? () from /usr/lib/R/lib/libR.so
#41 0x00007ffff7caa998 in ?? () from /usr/lib/R/lib/libR.so
#42 0x00007ffff7c95d42 in ?? () from /usr/lib/R/lib/libR.so
#43 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#44 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#45 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#46 0x00007ffff7c9acfd in ?? () from /usr/lib/R/lib/libR.so
#47 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#48 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#49 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#50 0x00007ffff7c9acfd in ?? () from /usr/lib/R/lib/libR.so
#51 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#52 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#53 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#54 0x00007ffff7c9acfd in ?? () from /usr/lib/R/lib/libR.so
#55 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#56 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#57 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#58 0x00007ffff7c9acfd in ?? () from /usr/lib/R/lib/libR.so
#59 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#60 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#61 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#62 0x00007ffff7ca9e2c in Rf_eval () from /usr/lib/R/lib/libR.so
#63 0x00007ffff7cae8a2 in ?? () from /usr/lib/R/lib/libR.so
#64 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#65 0x00007ffff7cad388 in ?? () from /usr/lib/R/lib/libR.so
#66 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#67 0x00007ffff7cb1540 in ?? () from /usr/lib/R/lib/libR.so
#68 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#69 0x00007ffff7cad388 in ?? () from /usr/lib/R/lib/libR.so
#70 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#71 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#72 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#73 0x00007ffff7c9acfd in ?? () from /usr/lib/R/lib/libR.so
#74 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#75 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#76 0x00007ffff7cacef9 in R_execMethod () from /usr/lib/R/lib/libR.so
#77 0x00007ffff44d1940 in ?? () from /usr/lib/R/library/methods/libs/methods.so
#78 0x00007ffff7cf4879 in ?? () from /usr/lib/R/lib/libR.so
#79 0x00007ffff7c9c0f5 in ?? () from /usr/lib/R/lib/libR.so
#80 0x00007ffff7ca9d00 in Rf_eval () from /usr/lib/R/lib/libR.so
#81 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#82 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#83 0x00007ffff7ca9e2c in Rf_eval () from /usr/lib/R/lib/libR.so
#84 0x00007ffff7cae8a2 in ?? () from /usr/lib/R/lib/libR.so
#85 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#86 0x00007ffff7cad388 in ?? () from /usr/lib/R/lib/libR.so
#87 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#88 0x00007ffff7cabd96 in ?? () from /usr/lib/R/lib/libR.so
#89 0x00007ffff7cacbc5 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#90 0x00007ffff7ca9e2c in Rf_eval () from /usr/lib/R/lib/libR.so
#91 0x00007ffff7cae8a2 in ?? () from /usr/lib/R/lib/libR.so
#92 0x00007ffff7caa110 in Rf_eval () from /usr/lib/R/lib/libR.so
#93 0x00007ffff7cdfd1a in Rf_ReplIteration () from /usr/lib/R/lib/libR.so
#94 0x00007ffff7ce00b0 in ?? () from /usr/lib/R/lib/libR.so
#95 0x00007ffff7ce0170 in run_Rmainloop () from /usr/lib/R/lib/libR.so
#96 0x000055555555509f in main ()
#97 0x00007ffff7958d90 in __libc_start_call_main (main=main@entry=0x555555555080 <main>, argc=argc@entry=2, argv=argv@entry=0x7fffffffdfa8) at ../sysdeps/nptl/libc_start_call_main.h:58
#98 0x00007ffff7958e40 in __libc_start_main_impl (main=0x555555555080 <main>, argc=2, argv=0x7fffffffdfa8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdf98) at ../csu/libc-start.c:392
#99 0x00005555555550d5 in _start ()
(gdb) 

There's now an updated version on CRAN; let me know if it addresses the original issue

I'm going to close this issue assuming that the original problem has been addressed, but feel free to open a new one (or I can re-open this one) if needed

Can you run the geostan currently on CRAN through winbuilder again? It's r-devel has the StanHeaders that ostensibly does not crash geostan anymore. Thanks.

Yeah, looks good!

No errors using r-dev:

  • using R Under development (unstable) (2024-01-07 r85787 ucrt)