Innocent little models won't fit in rstanarm

904 views
Skip to first unread message

Andrew Gelman

unread,
Feb 1, 2017, 12:54:25 AM2/1/17
to Stan users mailing list
Hi, I ran stan_glm() and it crashed 2 of the chains! Data are attached. My R code is below, then I'll show you the output in the R console. There's no way this should be happening!
A

--

library("rstanarm")
options(mc.cores = parallel::detectCores())
library("arm")
library("loo")

wells <- read.csv("wells.csv")
N <- nrow(wells)
dist100 <- wells$dist100
arsenic <- wells$arsenic
y <- wells$y

bayes_fit_3 <- stan_glm(y ~ dist100 + arsenic, family=binomial(link="logit"), prior=normal(0, 10, autoscale=FALSE))
# This fits just fine.

log_arsenic <- log(arsenic)
bayes_fit_3a <- stan_glm(y ~ dist100 + log(arsenic), family=binomial(link="logit"), prior=normal(0, 10, autoscale=FALSE))
# This fits fine too.

bayes_fit_4a <- stan_glm(y ~ dist100 + log_arsenic + dist100:log_arsenic, family=binomial(link="logit"), prior=normal(0, 10, autoscale=FALSE))
# This one also works.

bayes_fit_4 <- stan_glm(y ~ dist100 + arsenic + dist100:arsenic, family=binomial(link="logit"), prior=normal(0, 10, autoscale=FALSE))
# This one has big, big problems It runs really slowly and then returns these warnings:
Warning messages:
1: There were 981 divergent transitions after warmup. Increasing adapt_delta above 0.95 may help. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
2: There were 1 chains where the estimated Bayesian Fraction of Missing Information was low. See
http://mc-stan.org/misc/warnings.html#bfmi-low
3: Examine the pairs() plot to diagnose sampling problems
4: Markov chains did not converge! Do not analyze results!

# Why such problems? The simple glm(y ~ dist100 + arsenic + dist100:arsenic, family=binomial(link="logit")) runs just fine, it's not like the variables are collinear or anything. And in my stan_glm run I had proper priors. Sure, N(0,10) is vague, but it's not _that_ vague.

# And now the model that fails:

noise <- array(rnorm(5*n), c(n, 5))
write.table(noise, "noise.txt") # File is attached so this can be reproduced
bayes_fit_4b <- stan_glm(y ~ dist100 + log_arsenic + dist100:log_arsenic + noise, family=binomial(link="logit"), prior=normal(0, 10, autoscale=FALSE))
# See error messages below.

starting worker pid=49971 on localhost:11411 at 00:32:46.920
starting worker pid=49979 on localhost:11411 at 00:32:47.077
starting worker pid=49987 on localhost:11411 at 00:32:47.237
starting worker pid=49995 on localhost:11411 at 00:32:47.405

SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 1).
[1] "Rejecting initial value:"
[2] " Log probability evaluates to log(0), i.e. negative infinity."
[3] " Stan can't start sampling from this initial value."
[4] "Rejecting initial value:"
[5] " Log probability evaluates to log(0), i.e. negative infinity."
[6] " Stan can't start sampling from this initial value."
[7] "Rejecting initial value:"
[8] " Log probability evaluates to log(0), i.e. negative infinity."
[9] " Stan can't start sampling from this initial value."
[10] "Rejecting initial value:"
[11] " Log probability evaluates to log(0), i.e. negative infinity."
[12] " Stan can't start sampling from this initial value."
[13] "Rejecting initial value:"
[14] " Log probability evaluates to log(0), i.e. negative infinity."
[15] " Stan can't start sampling from this initial value."
[16] "Rejecting initial value:"
[17] " Log probability evaluates to log(0), i.e. negative infinity."
[18] " Stan can't start sampling from this initial value."
[19] "Rejecting initial value:"
[20] " Log probability evaluates to log(0), i.e. negative infinity."
[21] " Stan can't start sampling from this initial value."
[22] "Rejecting initial value:"
[23] " Log probability evaluates to log(0), i.e. negative infinity."
[24] " Stan can't start sampling from this initial value."
[25] "Rejecting initial value:"
[26] " Log probability evaluates to log(0), i.e. negative infinity."
[27] " Stan can't start sampling from this initial value."
[28] "Rejecting initial value:"
[29] " Log probability evaluates to log(0), i.e. negative infinity."
[30] " Stan can't start sampling from this initial value."
[31] "Rejecting initial value:"
[32] " Log probability evaluates to log(0), i.e. negative infinity."
[33] " Stan can't start sampling from this initial value."
[34] "Rejecting initial value:"
[35] " Log probability evaluates to log(0), i.e. negative infinity."
[36] " Stan can't start sampling from this initial value."
[37] "Rejecting initial value:"
[38] " Log probability evaluates to log(0), i.e. negative infinity."
[39] " Stan can't start sampling from this initial value."
[40] "Rejecting initial value:"
[41] " Log probability evaluates to log(0), i.e. negative infinity."
[42] " Stan can't start sampling from this initial value."
[43] "Rejecting initial value:"
[44] " Log probability evaluates to log(0), i.e. negative infinity."
[45] " Stan can't start sampling from this initial value."
[46] "Rejecting initial value:"
[47] " Log probability evaluates to log(0), i.e. negative infinity."
[48] " Stan can't start sampling from this initial value."
[49] "Rejecting initial value:"
[50] " Log probability evaluates to log(0), i.e. negative infinity."
[51] " Stan can't start sampling from this initial value."
[52] "Rejecting initial value:"
[53] " Log probability evaluates to log(0), i.e. negative infinity."
[54] " Stan can't start sampling from this initial value."
[55] "Rejecting initial value:"
[56] " Log probability evaluates to log(0), i.e. negative infinity."
[57] " Stan can't start sampling from this initial value."
[58] "Rejecting initial value:"
[59] " Log probability evaluates to log(0), i.e. negative infinity."
[60] " Stan can't start sampling from this initial value."
[61] "Rejecting initial value:"
[62] " Log probability evaluates to log(0), i.e. negative infinity."
[63] " Stan can't start sampling from this initial value."
[64] "Rejecting initial value:"
[65] " Log probability evaluates to log(0), i.e. negative infinity."
[66] " Stan can't start sampling from this initial value."
[67] "Rejecting initial value:"
[68] " Log probability evaluates to log(0), i.e. negative infinity."
[69] " Stan can't start sampling from this initial value."
[70] "Rejecting initial value:"
[71] " Log probability evaluates to log(0), i.e. negative infinity."
[72] " Stan can't start sampling from this initial value."
[73] "Rejecting initial value:"
[74] " Log probability evaluates to log(0), i.e. negative infinity."
[75] " Stan can't start sampling from this initial value."
[76] "Rejecting initial value:"
[77] " Log probability evaluates to log(0), i.e. negative infinity."
[78] " Stan can't start sampling from this initial value."
[79] "Rejecting initial value:"
[80] " Log probability evaluates to log(0), i.e. negative infinity."
[81] " Stan can't start sampling from this initial value."
[82] "Rejecting initial value:"
[83] " Log probability evaluates to log(0), i.e. negative infinity."
[84] " Stan can't start sampling from this initial value."
[85] "Rejecting initial value:"
[86] " Log probability evaluates to log(0), i.e. negative infinity."
[87] " Stan can't start sampling from this initial value."
[88] "Rejecting initial value:"
[89] " Log probability evaluates to log(0), i.e. negative infinity."
[90] " Stan can't start sampling from this initial value."
[91] "Rejecting initial value:"
[92] " Log probability evaluates to log(0), i.e. negative infinity."
[93] " Stan can't start sampling from this initial value."
[94] "Rejecting initial value:"
[95] " Log probability evaluates to log(0), i.e. negative infinity."
[96] " Stan can't start sampling from this initial value."
[97] "Rejecting initial value:"
[98] " Log probability evaluates to log(0), i.e. negative infinity."
[99] " Stan can't start sampling from this initial value."
[100] "Rejecting initial value:"
[101] " Log probability evaluates to log(0), i.e. negative infinity."
[102] " Stan can't start sampling from this initial value."
[103] "Rejecting initial value:"
[104] " Log probability evaluates to log(0), i.e. negative infinity."
[105] " Stan can't start sampling from this initial value."
[106] "Rejecting initial value:"
[107] " Log probability evaluates to log(0), i.e. negative infinity."
[108] " Stan can't start sampling from this initial value."
[109] "Rejecting initial value:"
[110] " Log probability evaluates to log(0), i.e. negative infinity."
[111] " Stan can't start sampling from this initial value."
[112] "Rejecting initial value:"
[113] " Log probability evaluates to log(0), i.e. negative infinity."
[114] " Stan can't start sampling from this initial value."
[115] "Rejecting initial value:"
[116] " Log probability evaluates to log(0), i.e. negative infinity."
[117] " Stan can't start sampling from this initial value."
[118] "Rejecting initial value:"
[119] " Log probability evaluates to log(0), i.e. negative infinity."
[120] " Stan can't start sampling from this initial value."
[121] "Rejecting initial value:"
[122] " Log probability evaluates to log(0), i.e. negative infinity."
[123] " Stan can't start sampling from this initial value."
[124] "Rejecting initial value:"
[125] " Log probability evaluates to log(0), i.e. negative infinity."
[126] " Stan can't start sampling from this initial value."
[127] "Rejecting initial value:"
[128] " Log probability evaluates to log(0), i.e. negative infinity."
[129] " Stan can't start sampling from this initial value."
[130] "Rejecting initial value:"
[131] " Log probability evaluates to log(0), i.e. negative infinity."
[132] " Stan can't start sampling from this initial value."
[133] "Rejecting initial value:"
[134] " Log probability evaluates to log(0), i.e. negative infinity."
[135] " Stan can't start sampling from this initial value."
[136] "Rejecting initial value:"
[137] " Log probability evaluates to log(0), i.e. negative infinity."
[138] " Stan can't start sampling from this initial value."
[139] "Rejecting initial value:"
[140] " Log probability evaluates to log(0), i.e. negative infinity."
[141] " Stan can't start sampling from this initial value."
[142] "Rejecting initial value:"
[143] " Log probability evaluates to log(0), i.e. negative infinity."
[144] " Stan can't start sampling from this initial value."
[145] "Rejecting initial value:"
[146] " Log probability evaluates to log(0), i.e. negative infinity."
[147] " Stan can't start sampling from this initial value."
[148] "Rejecting initial value:"
[149] " Log probability evaluates to log(0), i.e. negative infinity."
[150] " Stan can't start sampling from this initial value."
[151] "Rejecting initial value:"
[152] " Log probability evaluates to log(0), i.e. negative infinity."
[153] " Stan can't start sampling from this initial value."
[154] "Rejecting initial value:"
[155] " Log probability evaluates to log(0), i.e. negative infinity."
[156] " Stan can't start sampling from this initial value."
[157] "Rejecting initial value:"
[158] " Log probability evaluates to log(0), i.e. negative infinity."
[159] " Stan can't start sampling from this initial value."
[160] "Rejecting initial value:"
[161] " Log probability evaluates to log(0), i.e. negative infinity."
[162] " Stan can't start sampling from this initial value."
[163] "Rejecting initial value:"
[164] " Log probability evaluates to log(0), i.e. negative infinity."
[165] " Stan can't start sampling from this initial value."
[166] "Rejecting initial value:"
[167] " Log probability evaluates to log(0), i.e. negative infinity."
[168] " Stan can't start sampling from this initial value."
[169] "Rejecting initial value:"
[170] " Log probability evaluates to log(0), i.e. negative infinity."
[171] " Stan can't start sampling from this initial value."
[172] "Rejecting initial value:"
[173] " Log probability evaluates to log(0), i.e. negative infinity."
[174] " Stan can't start sampling from this initial value."
[175] "Rejecting initial value:"
[176] " Log probability evaluates to log(0), i.e. negative infinity."
[177] " Stan can't start sampling from this initial value."
[178] "Rejecting initial value:"
[179] " Log probability evaluates to log(0), i.e. negative infinity."
[180] " Stan can't start sampling from this initial value."
[181] "Rejecting initial value:"
[182] " Log probability evaluates to log(0), i.e. negative infinity."
[183] " Stan can't start sampling from this initial value."
[184] "Rejecting initial value:"
[185] " Log probability evaluates to log(0), i.e. negative infinity."
[186] " Stan can't start sampling from this initial value."
[187] "Rejecting initial value:"
[188] " Log probability evaluates to log(0), i.e. negative infinity."
[189] " Stan can't start sampling from this initial value."
[190] "Rejecting initial value:"
[191] " Log probability evaluates to log(0), i.e. negative infinity."
[192] " Stan can't start sampling from this initial value."
[193] "Rejecting initial value:"
[194] " Log probability evaluates to log(0), i.e. negative infinity."
[195] " Stan can't start sampling from this initial value."
[196] "Rejecting initial value:"
[197] " Log probability evaluates to log(0), i.e. negative infinity."
[198] " Stan can't start sampling from this initial value."
[199] "Rejecting initial value:"
[200] " Log probability evaluates to log(0), i.e. negative infinity."
[201] " Stan can't start sampling from this initial value."
[202] "Rejecting initial value:"
[203] " Log probability evaluates to log(0), i.e. negative infinity."
[204] " Stan can't start sampling from this initial value."
[205] "Rejecting initial value:"
[206] " Log probability evaluates to log(0), i.e. negative infinity."
[207] " Stan can't start sampling from this initial value."
[208] "Rejecting initial value:"
[209] " Log probability evaluates to log(0), i.e. negative infinity."
[210] " Stan can't start sampling from this initial value."
[211] "Rejecting initial value:"
[212] " Log probability evaluates to log(0), i.e. negative infinity."
[213] " Stan can't start sampling from this initial value."
[214] "Rejecting initial value:"
[215] " Log probability evaluates to log(0), i.e. negative infinity."
[216] " Stan can't start sampling from this initial value."
[217] "Rejecting initial value:"
[218] " Log probability evaluates to log(0), i.e. negative infinity."
[219] " Stan can't start sampling from this initial value."
[220] "Rejecting initial value:"
[221] " Log probability evaluates to log(0), i.e. negative infinity."
[222] " Stan can't start sampling from this initial value."
[223] "Rejecting initial value:"
[224] " Log probability evaluates to log(0), i.e. negative infinity."
[225] " Stan can't start sampling from this initial value."
[226] "Rejecting initial value:"
[227] " Log probability evaluates to log(0), i.e. negative infinity."
[228] " Stan can't start sampling from this initial value."
[229] "Rejecting initial value:"
[230] " Log probability evaluates to log(0), i.e. negative infinity."
[231] " Stan can't start sampling from this initial value."
[232] "Rejecting initial value:"
[233] " Log probability evaluates to log(0), i.e. negative infinity."
[234] " Stan can't start sampling from this initial value."
[235] "Rejecting initial value:"
[236] " Log probability evaluates to log(0), i.e. negative infinity."
[237] " Stan can't start sampling from this initial value."
[238] "Rejecting initial value:"
[239] " Log probability evaluates to log(0), i.e. negative infinity."
[240] " Stan can't start sampling from this initial value."
[241] "Rejecting initial value:"
[242] " Log probability evaluates to log(0), i.e. negative infinity."
[243] " Stan can't start sampling from this initial value."
[244] "Rejecting initial value:"
[245] " Log probability evaluates to log(0), i.e. negative infinity."
[246] " Stan can't start sampling from this initial value."
[247] "Rejecting initial value:"
[248] " Log probability evaluates to log(0), i.e. negative infinity."
[249] " Stan can't start sampling from this initial value."
[250] "Rejecting initial value:"
[251] " Log probability evaluates to log(0), i.e. negative infinity."
[252] " Stan can't start sampling from this initial value."
[253] "Rejecting initial value:"
[254] " Log probability evaluates to log(0), i.e. negative infinity."
[255] " Stan can't start sampling from this initial value."
[256] "Rejecting initial value:"
[257] " Log probability evaluates to log(0), i.e. negative infinity."
[258] " Stan can't start sampling from this initial value."
[259] "Rejecting initial value:"
[260] " Log probability evaluates to log(0), i.e. negative infinity."
[261] " Stan can't start sampling from this initial value."
[262] "Rejecting initial value:"
[263] " Log probability evaluates to log(0), i.e. negative infinity."
[264] " Stan can't start sampling from this initial value."
[265] "Rejecting initial value:"
[266] " Log probability evaluates to log(0), i.e. negative infinity."
[267] " Stan can't start sampling from this initial value."
[268] "Rejecting initial value:"
[269] " Log probability evaluates to log(0), i.e. negative infinity."
[270] " Stan can't start sampling from this initial value."
[271] "Rejecting initial value:"
[272] " Log probability evaluates to log(0), i.e. negative infinity."
[273] " Stan can't start sampling from this initial value."
[274] "Rejecting initial value:"
[275] " Log probability evaluates to log(0), i.e. negative infinity."
[276] " Stan can't start sampling from this initial value."
[277] "Rejecting initial value:"
[278] " Log probability evaluates to log(0), i.e. negative infinity."
[279] " Stan can't start sampling from this initial value."
[280] "Rejecting initial value:"
[281] " Log probability evaluates to log(0), i.e. negative infinity."
[282] " Stan can't start sampling from this initial value."
[283] "Rejecting initial value:"
[284] " Log probability evaluates to log(0), i.e. negative infinity."
[285] " Stan can't start sampling from this initial value."
[286] "Rejecting initial value:"
[287] " Log probability evaluates to log(0), i.e. negative infinity."
[288] " Stan can't start sampling from this initial value."
[289] "Rejecting initial value:"
[290] " Log probability evaluates to log(0), i.e. negative infinity."
[291] " Stan can't start sampling from this initial value."
[292] "Rejecting initial value:"
[293] " Log probability evaluates to log(0), i.e. negative infinity."
[294] " Stan can't start sampling from this initial value."
[295] "Rejecting initial value:"
[296] " Log probability evaluates to log(0), i.e. negative infinity."
[297] " Stan can't start sampling from this initial value."
[298] "Rejecting initial value:"
[299] " Log probability evaluates to log(0), i.e. negative infinity."
[300] " Stan can't start sampling from this initial value."
[301] "Initialization between (-2, 2) failed after 100 attempts. "
[302] " Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model."
[303] "Error in sampler$call_sampler(args_list[[i]]) : "
error occurred during calling the sampler; sampling not done

SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 2).

Chain 2, Iteration: 1 / 2000 [ 0%] (Warmup)
SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 3).

Chain 3, Iteration: 1 / 2000 [ 0%] (Warmup)
SAMPLING FOR MODEL 'bernoulli' NOW (CHAIN 4).
[1] "Rejecting initial value:"
[2] " Log probability evaluates to log(0), i.e. negative infinity."
[3] " Stan can't start sampling from this initial value."
[4] "Rejecting initial value:"
[5] " Log probability evaluates to log(0), i.e. negative infinity."
[6] " Stan can't start sampling from this initial value."
[7] "Rejecting initial value:"
[8] " Log probability evaluates to log(0), i.e. negative infinity."
[9] " Stan can't start sampling from this initial value."
[10] "Rejecting initial value:"
[11] " Log probability evaluates to log(0), i.e. negative infinity."
[12] " Stan can't start sampling from this initial value."
[13] "Rejecting initial value:"
[14] " Log probability evaluates to log(0), i.e. negative infinity."
[15] " Stan can't start sampling from this initial value."
[16] "Rejecting initial value:"
[17] " Log probability evaluates to log(0), i.e. negative infinity."
[18] " Stan can't start sampling from this initial value."
[19] "Rejecting initial value:"
[20] " Log probability evaluates to log(0), i.e. negative infinity."
[21] " Stan can't start sampling from this initial value."
[22] "Rejecting initial value:"
[23] " Log probability evaluates to log(0), i.e. negative infinity."
[24] " Stan can't start sampling from this initial value."
[25] "Rejecting initial value:"
[26] " Log probability evaluates to log(0), i.e. negative infinity."
[27] " Stan can't start sampling from this initial value."
[28] "Rejecting initial value:"
[29] " Log probability evaluates to log(0), i.e. negative infinity."
[30] " Stan can't start sampling from this initial value."
[31] "Rejecting initial value:"
[32] " Log probability evaluates to log(0), i.e. negative infinity."
[33] " Stan can't start sampling from this initial value."
[34] "Rejecting initial value:"
[35] " Log probability evaluates to log(0), i.e. negative infinity."
[36] " Stan can't start sampling from this initial value."
[37] "Rejecting initial value:"
[38] " Log probability evaluates to log(0), i.e. negative infinity."
[39] " Stan can't start sampling from this initial value."
[40] "Rejecting initial value:"
[41] " Log probability evaluates to log(0), i.e. negative infinity."
[42] " Stan can't start sampling from this initial value."
[43] "Rejecting initial value:"
[44] " Log probability evaluates to log(0), i.e. negative infinity."
[45] " Stan can't start sampling from this initial value."
[46] "Rejecting initial value:"
[47] " Log probability evaluates to log(0), i.e. negative infinity."
[48] " Stan can't start sampling from this initial value."
[49] "Rejecting initial value:"
[50] " Log probability evaluates to log(0), i.e. negative infinity."
[51] " Stan can't start sampling from this initial value."
[52] "Rejecting initial value:"
[53] " Log probability evaluates to log(0), i.e. negative infinity."
[54] " Stan can't start sampling from this initial value."
[55] "Rejecting initial value:"
[56] " Log probability evaluates to log(0), i.e. negative infinity."
[57] " Stan can't start sampling from this initial value."
[58] "Rejecting initial value:"
[59] " Log probability evaluates to log(0), i.e. negative infinity."
[60] " Stan can't start sampling from this initial value."
[61] "Rejecting initial value:"
[62] " Log probability evaluates to log(0), i.e. negative infinity."
[63] " Stan can't start sampling from this initial value."
[64] "Rejecting initial value:"
[65] " Log probability evaluates to log(0), i.e. negative infinity."
[66] " Stan can't start sampling from this initial value."
[67] "Rejecting initial value:"
[68] " Log probability evaluates to log(0), i.e. negative infinity."
[69] " Stan can't start sampling from this initial value."
[70] "Rejecting initial value:"
[71] " Log probability evaluates to log(0), i.e. negative infinity."
[72] " Stan can't start sampling from this initial value."
[73] "Rejecting initial value:"
[74] " Log probability evaluates to log(0), i.e. negative infinity."
[75] " Stan can't start sampling from this initial value."
[76] "Rejecting initial value:"
[77] " Log probability evaluates to log(0), i.e. negative infinity."
[78] " Stan can't start sampling from this initial value."
[79] "Rejecting initial value:"
[80] " Log probability evaluates to log(0), i.e. negative infinity."
[81] " Stan can't start sampling from this initial value."
[82] "Rejecting initial value:"
[83] " Log probability evaluates to log(0), i.e. negative infinity."
[84] " Stan can't start sampling from this initial value."
[85] "Rejecting initial value:"
[86] " Log probability evaluates to log(0), i.e. negative infinity."
[87] " Stan can't start sampling from this initial value."
[88] "Rejecting initial value:"
[89] " Log probability evaluates to log(0), i.e. negative infinity."
[90] " Stan can't start sampling from this initial value."
[91] "Rejecting initial value:"
[92] " Log probability evaluates to log(0), i.e. negative infinity."
[93] " Stan can't start sampling from this initial value."
[94] "Rejecting initial value:"
[95] " Log probability evaluates to log(0), i.e. negative infinity."
[96] " Stan can't start sampling from this initial value."
[97] "Rejecting initial value:"
[98] " Log probability evaluates to log(0), i.e. negative infinity."
[99] " Stan can't start sampling from this initial value."
[100] "Rejecting initial value:"
[101] " Log probability evaluates to log(0), i.e. negative infinity."
[102] " Stan can't start sampling from this initial value."
[103] "Rejecting initial value:"
[104] " Log probability evaluates to log(0), i.e. negative infinity."
[105] " Stan can't start sampling from this initial value."
[106] "Rejecting initial value:"
[107] " Log probability evaluates to log(0), i.e. negative infinity."
[108] " Stan can't start sampling from this initial value."
[109] "Rejecting initial value:"
[110] " Log probability evaluates to log(0), i.e. negative infinity."
[111] " Stan can't start sampling from this initial value."
[112] "Rejecting initial value:"
[113] " Log probability evaluates to log(0), i.e. negative infinity."
[114] " Stan can't start sampling from this initial value."
[115] "Rejecting initial value:"
[116] " Log probability evaluates to log(0), i.e. negative infinity."
[117] " Stan can't start sampling from this initial value."
[118] "Rejecting initial value:"
[119] " Log probability evaluates to log(0), i.e. negative infinity."
[120] " Stan can't start sampling from this initial value."
[121] "Rejecting initial value:"
[122] " Log probability evaluates to log(0), i.e. negative infinity."
[123] " Stan can't start sampling from this initial value."
[124] "Rejecting initial value:"
[125] " Log probability evaluates to log(0), i.e. negative infinity."
[126] " Stan can't start sampling from this initial value."
[127] "Rejecting initial value:"
[128] " Log probability evaluates to log(0), i.e. negative infinity."
[129] " Stan can't start sampling from this initial value."
[130] "Rejecting initial value:"
[131] " Log probability evaluates to log(0), i.e. negative infinity."
[132] " Stan can't start sampling from this initial value."
[133] "Rejecting initial value:"
[134] " Log probability evaluates to log(0), i.e. negative infinity."
[135] " Stan can't start sampling from this initial value."
[136] "Rejecting initial value:"
[137] " Log probability evaluates to log(0), i.e. negative infinity."
[138] " Stan can't start sampling from this initial value."
[139] "Rejecting initial value:"
[140] " Log probability evaluates to log(0), i.e. negative infinity."
[141] " Stan can't start sampling from this initial value."
[142] "Rejecting initial value:"
[143] " Log probability evaluates to log(0), i.e. negative infinity."
[144] " Stan can't start sampling from this initial value."
[145] "Rejecting initial value:"
[146] " Log probability evaluates to log(0), i.e. negative infinity."
[147] " Stan can't start sampling from this initial value."
[148] "Rejecting initial value:"
[149] " Log probability evaluates to log(0), i.e. negative infinity."
[150] " Stan can't start sampling from this initial value."
[151] "Rejecting initial value:"
[152] " Log probability evaluates to log(0), i.e. negative infinity."
[153] " Stan can't start sampling from this initial value."
[154] "Rejecting initial value:"
[155] " Log probability evaluates to log(0), i.e. negative infinity."
[156] " Stan can't start sampling from this initial value."
[157] "Rejecting initial value:"
[158] " Log probability evaluates to log(0), i.e. negative infinity."
[159] " Stan can't start sampling from this initial value."
[160] "Rejecting initial value:"
[161] " Log probability evaluates to log(0), i.e. negative infinity."
[162] " Stan can't start sampling from this initial value."
[163] "Rejecting initial value:"
[164] " Log probability evaluates to log(0), i.e. negative infinity."
[165] " Stan can't start sampling from this initial value."
[166] "Rejecting initial value:"
[167] " Log probability evaluates to log(0), i.e. negative infinity."
[168] " Stan can't start sampling from this initial value."
[169] "Rejecting initial value:"
[170] " Log probability evaluates to log(0), i.e. negative infinity."
[171] " Stan can't start sampling from this initial value."
[172] "Rejecting initial value:"
[173] " Log probability evaluates to log(0), i.e. negative infinity."
[174] " Stan can't start sampling from this initial value."
[175] "Rejecting initial value:"
[176] " Log probability evaluates to log(0), i.e. negative infinity."
[177] " Stan can't start sampling from this initial value."
[178] "Rejecting initial value:"
[179] " Log probability evaluates to log(0), i.e. negative infinity."
[180] " Stan can't start sampling from this initial value."
[181] "Rejecting initial value:"
[182] " Log probability evaluates to log(0), i.e. negative infinity."
[183] " Stan can't start sampling from this initial value."
[184] "Rejecting initial value:"
[185] " Log probability evaluates to log(0), i.e. negative infinity."
[186] " Stan can't start sampling from this initial value."
[187] "Rejecting initial value:"
[188] " Log probability evaluates to log(0), i.e. negative infinity."
[189] " Stan can't start sampling from this initial value."
[190] "Rejecting initial value:"
[191] " Log probability evaluates to log(0), i.e. negative infinity."
[192] " Stan can't start sampling from this initial value."
[193] "Rejecting initial value:"
[194] " Log probability evaluates to log(0), i.e. negative infinity."
[195] " Stan can't start sampling from this initial value."
[196] "Rejecting initial value:"
[197] " Log probability evaluates to log(0), i.e. negative infinity."
[198] " Stan can't start sampling from this initial value."
[199] "Rejecting initial value:"
[200] " Log probability evaluates to log(0), i.e. negative infinity."
[201] " Stan can't start sampling from this initial value."
[202] "Rejecting initial value:"
[203] " Log probability evaluates to log(0), i.e. negative infinity."
[204] " Stan can't start sampling from this initial value."
[205] "Rejecting initial value:"
[206] " Log probability evaluates to log(0), i.e. negative infinity."
[207] " Stan can't start sampling from this initial value."
[208] "Rejecting initial value:"
[209] " Log probability evaluates to log(0), i.e. negative infinity."
[210] " Stan can't start sampling from this initial value."
[211] "Rejecting initial value:"
[212] " Log probability evaluates to log(0), i.e. negative infinity."
[213] " Stan can't start sampling from this initial value."
[214] "Rejecting initial value:"
[215] " Log probability evaluates to log(0), i.e. negative infinity."
[216] " Stan can't start sampling from this initial value."
[217] "Rejecting initial value:"
[218] " Log probability evaluates to log(0), i.e. negative infinity."
[219] " Stan can't start sampling from this initial value."
[220] "Rejecting initial value:"
[221] " Log probability evaluates to log(0), i.e. negative infinity."
[222] " Stan can't start sampling from this initial value."
[223] "Rejecting initial value:"
[224] " Log probability evaluates to log(0), i.e. negative infinity."
[225] " Stan can't start sampling from this initial value."
[226] "Rejecting initial value:"
[227] " Log probability evaluates to log(0), i.e. negative infinity."
[228] " Stan can't start sampling from this initial value."
[229] "Rejecting initial value:"
[230] " Log probability evaluates to log(0), i.e. negative infinity."
[231] " Stan can't start sampling from this initial value."
[232] "Rejecting initial value:"
[233] " Log probability evaluates to log(0), i.e. negative infinity."
[234] " Stan can't start sampling from this initial value."
[235] "Rejecting initial value:"
[236] " Log probability evaluates to log(0), i.e. negative infinity."
[237] " Stan can't start sampling from this initial value."
[238] "Rejecting initial value:"
[239] " Log probability evaluates to log(0), i.e. negative infinity."
[240] " Stan can't start sampling from this initial value."
[241] "Rejecting initial value:"
[242] " Log probability evaluates to log(0), i.e. negative infinity."
[243] " Stan can't start sampling from this initial value."
[244] "Rejecting initial value:"
[245] " Log probability evaluates to log(0), i.e. negative infinity."
[246] " Stan can't start sampling from this initial value."
[247] "Rejecting initial value:"
[248] " Log probability evaluates to log(0), i.e. negative infinity."
[249] " Stan can't start sampling from this initial value."
[250] "Rejecting initial value:"
[251] " Log probability evaluates to log(0), i.e. negative infinity."
[252] " Stan can't start sampling from this initial value."
[253] "Rejecting initial value:"
[254] " Log probability evaluates to log(0), i.e. negative infinity."
[255] " Stan can't start sampling from this initial value."
[256] "Rejecting initial value:"
[257] " Log probability evaluates to log(0), i.e. negative infinity."
[258] " Stan can't start sampling from this initial value."
[259] "Rejecting initial value:"
[260] " Log probability evaluates to log(0), i.e. negative infinity."
[261] " Stan can't start sampling from this initial value."
[262] "Rejecting initial value:"
[263] " Log probability evaluates to log(0), i.e. negative infinity."
[264] " Stan can't start sampling from this initial value."
[265] "Rejecting initial value:"
[266] " Log probability evaluates to log(0), i.e. negative infinity."
[267] " Stan can't start sampling from this initial value."
[268] "Rejecting initial value:"
[269] " Log probability evaluates to log(0), i.e. negative infinity."
[270] " Stan can't start sampling from this initial value."
[271] "Rejecting initial value:"
[272] " Log probability evaluates to log(0), i.e. negative infinity."
[273] " Stan can't start sampling from this initial value."
[274] "Rejecting initial value:"
[275] " Log probability evaluates to log(0), i.e. negative infinity."
[276] " Stan can't start sampling from this initial value."
[277] "Rejecting initial value:"
[278] " Log probability evaluates to log(0), i.e. negative infinity."
[279] " Stan can't start sampling from this initial value."
[280] "Rejecting initial value:"
[281] " Log probability evaluates to log(0), i.e. negative infinity."
[282] " Stan can't start sampling from this initial value."
[283] "Rejecting initial value:"
[284] " Log probability evaluates to log(0), i.e. negative infinity."
[285] " Stan can't start sampling from this initial value."
[286] "Rejecting initial value:"
[287] " Log probability evaluates to log(0), i.e. negative infinity."
[288] " Stan can't start sampling from this initial value."
[289] "Rejecting initial value:"
[290] " Log probability evaluates to log(0), i.e. negative infinity."
[291] " Stan can't start sampling from this initial value."
[292] "Rejecting initial value:"
[293] " Log probability evaluates to log(0), i.e. negative infinity."
[294] " Stan can't start sampling from this initial value."
[295] "Rejecting initial value:"
[296] " Log probability evaluates to log(0), i.e. negative infinity."
[297] " Stan can't start sampling from this initial value."
[298] "Rejecting initial value:"
[299] " Log probability evaluates to log(0), i.e. negative infinity."
[300] " Stan can't start sampling from this initial value."
[301] "Initialization between (-2, 2) failed after 100 attempts. "
[302] " Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model."
[303] "Error in sampler$call_sampler(args_list[[i]]) : "
error occurred during calling the sampler; sampling not done

Chain 2, Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 3, Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2, Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 3, Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2, Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 3, Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2, Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 3, Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2, Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2, Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 3, Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 3, Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2, Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 3, Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2, Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 3, Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2, Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2, Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3, Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2, Iteration: 2000 / 2000 [100%] (Sampling)
Elapsed Time: 5.94232 seconds (Warm-up)
6.49544 seconds (Sampling)
12.4378 seconds (Total)


Chain 3, Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 3, Iteration: 2000 / 2000 [100%] (Sampling)
Elapsed Time: 6.39546 seconds (Warm-up)
7.28456 seconds (Sampling)
13.68 seconds (Total)

here are whatever error messages were returned
[[1]]
Stan model 'bernoulli' does not contain samples.

[[2]]
Stan model 'bernoulli' does not contain samples.

Warning message:
In .local(object, ...) :
some chains had errors; consider specifying chains = 1 to debug

wells.csv
noise.txt

Ben Goodrich

unread,
Feb 1, 2017, 11:41:29 AM2/1/17
to Stan users mailing list, gel...@stat.columbia.edu
On Wednesday, February 1, 2017 at 12:54:25 AM UTC-5, Andrew Gelman wrote:
There's no way this should be happening!

Way. If you have interaction terms and / or polynomials, then the derived variables have weird units and weird associations with the constituent variables, and adjusting the priors marginally is insufficient to achieve good performance from Stan. If you use the QR reparameterization like the documentation / vignettes / us suggest, then it is fine:

library(rstanarm)
data
(wells)
wells$dist100
<- wells$dist / 100
whatever
<- normal(0,10)
bayes_fit_4a
<- stan_glm(switch ~ dist100 * log(arsenic), data = wells,
                         family
=binomial(link="logit"), QR = TRUE, prior = whatever)

Ben

Jonah Gabry

unread,
Feb 1, 2017, 12:18:44 PM2/1/17
to Stan users mailing list, gel...@stat.columbia.edu
I actually think rstanarm is behaving properly here in the sense that this is not happening because of a bug in the code but rather because of model that's actually trickier than it seems. It's just that the model that gives divergence warnings and the one that fails entirely are challenging for Stan (for the reasons Ben mentioned). But I was able to successfully run the model (using the attached noise.txt) in three different ways:

(a) using Ben's QR trick: see his response above

(b) setting autoscale=TRUE (or omitting it) to let rstanarm do the rescaling of the prior (it really doesn't like normal(0,10) with autoscale=FALSE for this model):

bayes_fit_4b2 <- stan_glm(

  y
~ dist100 + log_arsenic + dist100:log_arsenic + noise,
  family
=binomial(link="logit"),

  prior
=normal(0, 10, autoscale=TRUE)
)

and (c) keeping autoscale=FALSE but reducing the range for random inits using init_r: 

bayes_fit_4b2 <- stan_glm(

  y
~ dist100 + log_arsenic + dist100:log_arsenic + noise,
  family
=binomial(link="logit"),

  prior
=normal(0, 10, autoscale=FALSE),
  init_r
= 0.1
)

The model fits without warning for me using methods (a), (b), and (c), although they're not all equally efficient. 

Jonah

P.S. The wells dataset is actually included in rstanarm (because it's used in one of the vignettes) so you don't need to load it separately. See help("rstanarm-datasets") for the full list of included datasets. Also, this isn't part of the problem in this case, but I highly recommend using model formula + data when fitting the model instead of assigning things to the global environment and then just using the formula without data. The reason is partly related to the problem with kfold, but in general R is just so much more robust to errors if objects named in formulas are looked for inside other objects (e.g. data frames) rather than in environments.

Bob Carpenter

unread,
Feb 1, 2017, 1:16:54 PM2/1/17
to stan-...@googlegroups.com
What does (b) rescaling the prior do to the model?

- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Jonah Gabry

unread,
Feb 1, 2017, 1:33:07 PM2/1/17
to Stan users mailing list
On Wednesday, February 1, 2017 at 1:16:54 PM UTC-5, Bob Carpenter wrote:
What does (b) rescaling the prior do to the model?

- Bob 

rstanarm let's you either specify prior scales directly or specify them in terms of the scales of the predictors. If auto-rescaling is enabled then rstanarm will adjust the specified prior scale(s) using information about the scale(s) of the predictor variable(s). For example

prior = normal(0, 10, autoscale=FALSE)

means that the prior actually used is normal(0, 10), but 

prior = normal(0, 10, autoscale=TRUE)

means that the prior actually used is normal(0, 10 * scale_adjustment_factor), where the scale_adjustment factor is computed in the same way as it was in the original arm package. If you have the most recent version of rstanarm installed (via install.packages("rstanarm")) then the precise details about how that adjustment works are described in the doc for the "autoscale" argument at help("priors", package = "rstanarm"). 

Jonah


Bob Carpenter

unread,
Feb 1, 2017, 1:46:05 PM2/1/17
to stan-...@googlegroups.com
That really is a data-driven prior. And it's turned on by
default.

For everyone else's benefit:

autoscale
A logical scalar, defaulting to TRUE. If TRUE then the scales of the priors
on the intercept and regression coefficients may be additionally modified
internally by rstanarm as follows. First, if the outcome is Gaussian, the
prior scales for the intercept and coefficients are multiplied by 2*sd(y).
Additionally, if the QR argument to the model fitting function (e.g. stan_glm)
is FALSE then: for a predictor with only one value nothing is changed; for a
predictor x with exactly two unique values, we take the user-specified (or
default) scale(s) for the selected priors and divide by the range of x; for
a predictor x with more than two unique values, we divide the prior
scale(s) by 2*sd(x).

- Bob

Michael Betancourt

unread,
Feb 1, 2017, 1:50:44 PM2/1/17
to stan-...@googlegroups.com
Right, it’s sneakily empirical Bayes. But as Jonah noted
it’s also derived from the original arm package and so
people often expect it, no?

Definitely worth trying to make this more clear to users.

Jonah Sol Gabry

unread,
Feb 1, 2017, 1:57:27 PM2/1/17
to stan-...@googlegroups.com
It used to be a lot less apparent but in the most recent release we've done a few things to make it more clear: 

(1) We added the autoscale argument directly to the functions for specifying priors (instead of as a separate and easily overlooked argument 'scaled' to the modeling function, which was how arm did it)

(2) We introduced the prior_summary function which, for any rstanarm model, shows both the user-specified scales and the adjusted scales (if auto-scaling is on)

Regarding whether or not this is a good idea in general I have mixed feelings. On the one hand it's obviously not truly full Bayes anymore. On the other hand how else could we have default priors that aren't totally useless? This is one of the hard things about developing a package like rstanarm that attempts remove barriers to entry while still maintaining its integrity, so to speak. I think Andrew's original justification for it similar to what he says in this blog post: 



>> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

>> To post to this group, send email to stan-...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/PsxD2Gl4Lbk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.

Jonah Sol Gabry

unread,
Feb 1, 2017, 1:58:37 PM2/1/17
to stan-...@googlegroups.com
P.S. If anyone has suggests for how to make this even more clear please do let us know!

Ben Goodrich

unread,
Feb 1, 2017, 2:06:02 PM2/1/17
to Stan users mailing list
On Wednesday, February 1, 2017 at 1:50:44 PM UTC-5, Michael Betancourt wrote:
Definitely worth trying to make this more clear to users.

We are doubting that more than 5% of rstanarm users are interested in changing the default priors, but hopefully it is now clear enough for those 5%.

Bob Carpenter

unread,
Feb 1, 2017, 2:08:44 PM2/1/17
to stan-...@googlegroups.com
Even if users go with defaults, I'd think they'd want to
know what's going on so they can write it up in papers
or otherwise explain what they're doing to colleagues.

- Bob

Bob Carpenter

unread,
Feb 1, 2017, 2:15:55 PM2/1/17
to stan-...@googlegroups.com

> On Feb 1, 2017, at 1:57 PM, Jonah Sol Gabry <jga...@gmail.com> wrote:
>
> It used to be a lot less apparent but in the most recent release we've done a few things to make it more clear:
>
> (1) We added the autoscale argument directly to the functions for specifying priors (instead of as a separate and easily overlooked argument 'scaled' to the modeling function, which was how arm did it)
>
> (2) We introduced the prior_summary function which, for any rstanarm model, shows both the user-specified scales and the adjusted scales (if auto-scaling is on)
>
> Regarding whether or not this is a good idea in general I have mixed feelings. On the one hand it's obviously not truly full Bayes anymore. On the other hand how else could we have default priors that aren't totally useless? This is one of the hard things about developing a package like rstanarm that attempts remove barriers to entry while still maintaining its integrity, so to speak. I think Andrew's original justification for it similar to what he says in this blog post:
>
> http://andrewgelman.com/2016/03/25/28321/

Yup. Andrew does what other people call "empirical Bayes" but
won't call it that.

I don't see how a hyperprior on the scale of predictors is going
to help here.

vector[K] beta;
real beta;
real<lower=0> sigma;

mu_beta ~ ...
sigma_beta ~ ...
beta ~ normal(mu_beta, sigma_beta);

y ~ normal(x * beta, sigma_y);

(or maybe mu_beta is set to 0?) seems very different than

beta ~ normal(0, SIGMA);
y ~ normal(x ./ x_two_sigma * beta, sigma_y);

where SIGMA is some constant.

- Bob

Jonah Gabry

unread,
Feb 1, 2017, 2:24:04 PM2/1/17
to stan-...@googlegroups.com
On Wednesday, February 1, 2017 at 2:08:44 PM UTC-5, Bob Carpenter wrote:
Even if users go with defaults, I'd think they'd want to
know what's going on so they can write it up in papers
or otherwise explain what they're doing to colleagues.

- Bob 

Yeah, that was a large part of the motivation for adding the prior_summary function. For example, for a linear regression model the printed output from prior_summary looks like this: 

> prior_summary(fit)

Priors for model 'fit' 
------

Intercept (after predictors centered)
 ~ normal(location = 0, scale = 10)
     **adjusted scale = 120.54

Coefficients
 ~ normal(location = [0,0,0,...], scale = [10,10,10,...])
     **adjusted scale = [33.75, 0.49, 0.88,...]

Auxiliary (sigma)
 ~ cauchy(location = 0, scale = 5)

------
See help('prior_summary.stanreg') for more details


and the object actually returned by prior_summary also includes the stuff that get's shortened to "..." in the printed output. If the user follows the message at the bottom to check out the help page they'll see a short explanation and pointers to where they can find even more information if desired.

Oh, and take a look at the adjusted scale values. For the coefficients they range from 34 to less than 1 (for the intercept it's even > 100). That's why -- despite my own misgivings -- I've come around to the idea of having autoscale default to TRUE. How else can we avoid most models running into trouble if run with default settings? 
 


Bob Carpenter

unread,
Feb 1, 2017, 2:28:52 PM2/1/17
to stan-...@googlegroups.com
Those summaries look great. I hope people are using them.

I'm not arguing that you shouldn't be doing these data-driven
approximations---I'll leave those fights up to Michael and Andrew.
I just think it should be clear to users what they're
getting. The prior summary really helps.

- Bob


> On Feb 1, 2017, at 2:24 PM, Jonah Gabry <jga...@gmail.com> wrote:
>
> On Wednesday, February 1, 2017 at 2:08:44 PM UTC-5, Bob Carpenter wrote:
> Even if users go with defaults, I'd think they'd want to
> know what's going on so they can write it up in papers
> or otherwise explain what they're doing to colleagues.
>
> - Bob
>
> Yeah, that was a large part of the motivation for adding the prior_summary function. For example, for a linear regression model the printed output from prior_summary looks like this:
>
> > prior_summary(fit)
>
> Priors for model 'fit'
> ------
>
> Intercept (after predictors centered)
> ~ normal(location = 0, scale = 10)
> **adjusted scale = 120.54
>
> Coefficients
> ~ normal(location = [0,0,0,...], scale = [10,10,10,...])
> **adjusted scale = [33.75, 0.49, 0.88,...]
>
> Auxiliary (sigma)
> ~ cauchy(location = 0, scale = 5)
>
> ------
> See help('prior_summary.stanreg') for more details
>
>
> and the object actually returned by prior_summary also includes the stuff that get's shortened to "..." in the printed output. If the user follows the message at the bottom to check out the help page they'll see a short explanation and pointers to where they can find even more information if desired.
>
> Oh, and take a look at the adjusted scale values. They range from 34 to less than 1. That's why -- despite my own misgivings -- I've come around to the idea of having autoscale default to TRUE. How else can we avoid most models running into trouble if run with default settings?

Andrew Gelman

unread,
Feb 1, 2017, 8:27:09 PM2/1/17
to stan-...@googlegroups.com
Hi, Jonah and Ben.  We can talk more at our meeting about this.  I don't have a clear sense of how best to recommend informative priors in practice, and this was coming up when I was writing my chapter.  So we'll have a lot to talk about!
A

Jonah Sol Gabry

unread,
Feb 1, 2017, 11:23:35 PM2/1/17
to stan-...@googlegroups.com
Ok sounds good. We definitely have a lot to discuss!

You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/PsxD2Gl4Lbk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.

Aki Vehtari

unread,
Feb 2, 2017, 9:17:59 AM2/2/17
to Stan users mailing list
On Wednesday, February 1, 2017 at 7:57:27 PM UTC+1, Jonah Gabry wrote:
Regarding whether or not this is a good idea in general I have mixed feelings. On the one hand it's obviously not truly full Bayes anymore. On the other hand how else could we have default priors that aren't totally useless?

You can call them weakly informative priors. The scaling is based on the data, but since priors are wide, the amount of information used is weak and mainly takes into account the order of magnitude of the values. For example, if the measurements were heights of people, you could set non-data-dependent prior if you know whether the measurements are in mm, cm, inch, feet or m, but now you save some time by checking the order of magnitude from the data. You could make the default priors even wider if you want to make the even more weakly informative and of course autoscaling can give undesired results in case of outliers etc.

Aki

Michael Betancourt

unread,
Feb 2, 2017, 9:33:35 AM2/2/17
to stan-...@googlegroups.com
The problem is firstly that most users, especially of rstanarm, do not
even consider thinking about the priors like this (which is one of the
reasons I’m hesitant about pushing packages like these).  Even if 
they were interested, however, we have a lot of work to go in 
improving pedagogy that supports how to do this correctly.

Either we autoscale so that users don’t have to think and we get a
larger userbase (hopefully to be funneled into Stan proper, although
that’ll be a slow trickle at best) or we force more principled inputs
about scales and watch as the user base plummets.  

Good inferential practices are like vegetables for users.  They need
them but they really can’t be convinced of them and often the only
way we can get them to buy in is by covering them with a whole
bunch of sauce.

--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.

Ben Goodrich

unread,
Feb 2, 2017, 9:55:49 AM2/2/17
to Stan users mailing list
On Thursday, February 2, 2017 at 9:33:35 AM UTC-5, Michael Betancourt wrote:
Either we autoscale so that users don’t have to think and we get a
larger userbase (hopefully to be funneled into Stan proper, although
that’ll be a slow trickle at best) or we force more principled inputs
about scales and watch as the user base plummets.  

Andrew is pretty much the only one strongly pushing autoscaling. The rstanarm documentation and vignettes push QR = TRUE, which normalizes the predictors in a different way. Not many understand that either.

Michael Betancourt

unread,
Feb 2, 2017, 10:14:24 AM2/2/17
to stan-...@googlegroups.com
And you still have to be careful with QR as naively putting priors
on the transformed scale is just a more complex version of
empirical Bayes.  

Ultimately the issue here is that the packages that rstanarm is
emulating all disregard the prior as some awkward necessity
that is best not thought considered.  Again, trying to change
this narrative would compromise the user experience that many
people are expecting — there is no answer that will make
everyone happy.

Jonah Sol Gabry

unread,
Feb 2, 2017, 10:26:54 AM2/2/17
to stan-...@googlegroups.com
I wouldn't really say we've done much to "push" the QR stuff. If we really want people to use it we need to either make a big deal out of it (it's own vignette, a blog post, more messages from rstanarm suggesting it, etc) or default to it. 

--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/PsxD2Gl4Lbk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.

Michael Betancourt

unread,
Feb 2, 2017, 10:29:30 AM2/2/17
to stan-...@googlegroups.com
Either of those would be good — the QR transformation is magic when
the covariates are at all correlated, it just requires care when implementing
to ensure that you’re using principled priors.  At the same time, the QR prior
that is motivated by the transformation is also something that needs lots
more doc as it is highly underutilized as the moment.

You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.

Jonah Sol Gabry

unread,
Feb 2, 2017, 10:35:16 AM2/2/17
to stan-...@googlegroups.com
Yup, +1 to that and your previous comment 

Aki Vehtari

unread,
Feb 2, 2017, 5:54:41 PM2/2/17
to Stan users mailing list
Just to clarify if someone is counting votes for autoscaling: I don't like autoscaling priors although I can accept them as weakly informative priors if they are wide enough. I would prefer explicit scaling, so that modeler has to take the responsibility and thus think whether specific scaling is sensible. And naturally explicit scaling such as normalization or whitening is also using data and thus can be considered weakly informative scaling. I like to normalize covariates as then it's also easier to compare covariate effects (unless using APC or other predictive relevance estimates). 

Aki

Andrew Gelman

unread,
Feb 2, 2017, 7:52:20 PM2/2/17
to stan-...@googlegroups.com
In my books with Jennifer I'm trying to do both:
- Weak priors as a way to fit the regression that users know and love, but with more stable inference (for example, with logistic regression when there is separation in the data) and with posterior simulations (super-important when wanting uncertainty for anything more complicated than a single parameter).
- Informative priors when prior information is available.
A

On Feb 2, 2017, at 9:33 AM, Michael Betancourt <betan...@gmail.com> wrote:

Either we autoscale so that users don’t have to think and we get a
larger userbase (hopefully to be funneled into Stan proper, although
that’ll be a slow trickle at best) or we force more principled inputs
about scales and watch as the user base plummets.  


Reply all
Reply to author
Forward
0 new messages