Problems running radon example from ARM

49 views
Skip to first unread message

Chris

unread,
Jan 18, 2017, 1:00:01 PM1/18/17
to Stan users mailing list

Hi there,


I am trying to learn Stan, and run an example from Chapter 17 of Gelman & Hill (2006). I am running example 17.1_radon_wishart, from

https://github.com/stan-dev/example-models/blob/master/ARM/Ch.17/17.1_radon_wishart.stan

However, when I run it, I get a number of errors/warnings:

For each chain:                                                                 

Exception thrown at line 39: wishart_log: LDLT_Factor of random variable is not positive definite. count=8

Warning messages:

1: In readLines(file, warn = TRUE) :

 incomplete final line found on '/path/to/stan/17.1_radon_wishart.stan'

2: There were 170 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See

http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup

3: Examine the pairs() plot to diagnose sampling problems


I also receive the warnings that are pasted at the bottom of this message. I examine the pairs plot and there are divergent transitions above and below the diagonal. I have attached the files I am running, however note these are just copy/pasted from github.


It seems strange that an example problem would give such errors, so I must be doing something wrong! Help would be greatly appreciated.


I have R version 3.3.2 (2016-10-31), rstan_2.14.1 and RStudio Version 1.0.44 on OS Sierra. 

Thanks and regards, Chris


_________

In file included from file25d5d872186.cpp:8:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:12:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/core/gevv_vvv_vari.hpp:5:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/core/var.hpp:7:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include/boost/math/tools/config.hpp:13:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include/boost/config.hpp:39:

/Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include/boost/config/compiler/clang.hpp:196:11: warning: 'BOOST_NO_CXX11_RVALUE_REFERENCES' macro redefined [-Wmacro-redefined]

#  define BOOST_NO_CXX11_RVALUE_REFERENCES

         ^

<command line>:6:9: note: previous definition is here

#define BOOST_NO_CXX11_RVALUE_REFERENCES 1

       ^

In file included from file25d5d872186.cpp:8:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:42:

/Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:14:17: warning: unused function 'set_zero_all_adjoints' [-Wunused-function]

   static void set_zero_all_adjoints() {

               ^

In file included from file25d5d872186.cpp:8:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:43:

/Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints_nested.hpp:17:17: warning: 'static' function 'set_zero_all_adjoints_nested' declared in header file should be declared 'static inline' [-Wunneeded-internal-declaration]

   static void set_zero_all_adjoints_nested() {

               ^

In file included from file25d5d872186.cpp:8:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:11:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/prim/mat.hpp:60:

/Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/autocorrelation.hpp:17:14: warning: function 'fft_next_good_size' is not needed and will not be emitted [-Wunneeded-internal-declaration]

     size_t fft_next_good_size(size_t N) {

            ^

In file included from file25d5d872186.cpp:8:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math.hpp:4:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:11:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/prim/mat.hpp:299:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/prim/arr.hpp:36:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/StanHeaders/include/stan/math/prim/arr/functor/integrate_ode_rk45.hpp:13:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include/boost/numeric/odeint.hpp:61:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include/boost/numeric/odeint/util/multi_array_adaption.hpp:29:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include/boost/multi_array.hpp:21:

In file included from /Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include/boost/multi_array/base.hpp:28:

/Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include/boost/multi_array/concept_checks.hpp:42:43: warning: unused typedef 'index_range' [-Wunused-local-typedef]

     typedef typename Array::index_range index_range;

                                         ^

/Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include/boost/multi_array/concept_checks.hpp:43:37: warning: unused typedef 'index' [-Wunused-local-typedef]

     typedef typename Array::index index;

                                   ^

/Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include/boost/multi_array/concept_checks.hpp:53:43: warning: unused typedef 'index_range' [-Wunused-local-typedef]

     typedef typename Array::index_range index_range;

                                         ^

/Library/Frameworks/R.framework/Versions/3.3/Resources/library/BH/include/boost/multi_array/concept_checks.hpp:54:37: warning: unused typedef 'index' [-Wunused-local-typedef]

     typedef typename Array::index index;

                                   ^

8 warnings generated.


arm_example.zip

Bob Carpenter

unread,
Jan 18, 2017, 1:35:34 PM1/18/17
to stan-...@googlegroups.com
That models' not fitting well (the divergence warnings are real, but
the rest of it's just compiler stuff we haven't been able to silence in
R.

We need to go through and fix all those example models which
were just translated directly from the book (and often didn't work in BUGS,
either!). That's on the agenda this year.

For multivariate hierarchical priors, we strongly recommend the
Cholesky parameterization scaled correlation matrices as described
in the manual chapter on regression. To make Wishart efficient and
robust, we'd need to have a Cholesky factor parameterization, which
may be coming soon.

- 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.
> <arm_example.zip>

Jonah Gabry

unread,
Jan 18, 2017, 3:31:43 PM1/18/17
to Stan users mailing list
Adding to what Bob said about the compiler warnings, you don't need to worry about those (they're not causing any problems) but they are indeed annoying. If you want to try to turn them off this might help: http://mc-stan.org/misc/warnings.html#compiler-warnings. 

Jonah 

Chris

unread,
Jan 18, 2017, 4:23:58 PM1/18/17
to Stan users mailing list
Thanks very much Bob and Jonah for the prompt and informative replies. Very useful!
Chris
Reply all
Reply to author
Forward
0 new messages