stan runtime error "Exception: boost::too_many_args: format-string referred..."

618 views
Skip to first unread message

Will Morris

unread,
Dec 19, 2012, 10:06:42 PM12/19/12
to stan-...@googlegroups.com
Hi all,

Could someone please help me out with this runtime error (below) I am getting. Have tried to run this model (http://cl.ly/131S3n330Z1K, with data http://cl.ly/code/0G3z0o441S0E) on both a Mac and Linux with optimisation on and off. Both give this error I can't interpret. Stan (v-1.1.0) itself is working fine as I can run the example models without error.

Cheers,

STAN SAMPLING COMMAND
data = HKKdata.R
init = random initialization
init tries = 1
samples = samples.csv
append_samples = 0
save_warmup = 0
seed = 3176479917 (randomly generated)
chain_id = 1 (default)
iter = 2000
warmup = 1000
thin = 1 (default)
equal_step_sizes = 0
leapfrog_steps = -1
max_treedepth = 10
epsilon = -1
epsilon_pm = 0
delta = 0.5
gamma = 0.05

Exception: boost::too_many_args: format-string referred to less arguments than were passed
Diagnostic information: 
Throw location unknown (consider using BOOST_THROW_EXCEPTION)
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::io::too_many_args> >
std::exception::what: boost::too_many_args: format-string referred to less arguments than were passed

Daniel Lee

unread,
Dec 20, 2012, 12:11:27 AM12/20/12
to stan-...@googlegroups.com
Thanks for bringing this up. I haven't looked at your model, but this error message looks like a bug in Stan. I will try to hunt it down tomorrow. 


Daniel
--
 
 

Ben Goodrich

unread,
Dec 20, 2012, 4:15:04 AM12/20/12
to stan-...@googlegroups.com
On Wednesday, December 19, 2012 10:06:42 PM UTC-5, Will Morris wrote:
Could someone please help me out with this runtime error (below) I am getting. Have tried to run this model (http://cl.ly/131S3n330Z1K, with data http://cl.ly/code/0G3z0o441S0E) on both a Mac and Linux with optimisation on and off. Both give this error I can't interpret. Stan (v-1.1.0) itself is working fine as I can run the example models without error.

This is our bug. You can work around it by 1) restricting xi be slightly positive as in

real<lower=0.000001> xi[3];

and by 2) moving the calculation of the rhos into a generated quantities block at the end instead of the transformed parameters block

generated quantities {
  real
<lower=-1, upper=1> rho[3];
  rho
[1] <- Sigma_B_raw[1, 2] / sqrt(Sigma_B_raw[1, 1] * Sigma_B_raw[2, 2]);
  rho
[2] <- Sigma_B_raw[1, 3] / sqrt(Sigma_B_raw[1, 1] * Sigma_B_raw[3, 3]);
  rho
[3] <- Sigma_B_raw[2, 3] / sqrt(Sigma_B_raw[2, 2] * Sigma_B_raw[3, 3]);
}

In addition, although this is largely unrelated to the bug, if you are going to specify a uniform (0,100) prior on xi, then you should specify an upper bound on xi's support, like

real<lower=0.000001, upper=100> xi[3];

in which case, you do not need to explicitly specify the uniform prior on xi in the model block.

With all that, your model seems to run, albeit painfully slowly. There is a lot of new stuff in the Stan manual for v1.1.0 on reparameterizing models like this in Chapter 13.

Ben

William Morris

unread,
Dec 20, 2012, 7:52:03 PM12/20/12
to stan-...@googlegroups.com
Thanks Ben and Daniel.

The slightly positive lower bound on `xi` did the trick. But I get the same error if I try to specify an upper bound of 100 instead of the uniform prior.

Cheers,

Will Morris M.Phil.
Publications: Google Scholar
Twitter: @wkmor1
Skype: wkmor1
----------------------------------------------------------------------
Quantitative and Applied Ecology Group
The School of Botany
The University of Melbourne
----------------------------------------------------------------------
Environmental Decisions Group
ARC - Centre of Excellence for 
Environmental Decisions
NERP Environmental Decisions Hub
----------------------------------------------------------------------
$_$__ ,
 U___ }
  | |   | |

--
 
 

Daniel Lee

unread,
Dec 23, 2012, 11:54:31 AM12/23/12
to stan-...@googlegroups.com
Thanks for bringing up the issue. That was definitely a bug in Stan. The fix will appear in the next release. (commit 25509af)

If you're willing, try your model with the current source. As of today, the main branch is pretty stable.



Daniel



--
 
 

Reply all
Reply to author
Forward
0 new messages