effective sample size in mcmc::chains

19 views
Skip to first unread message

Jiqiang Guo

unread,
Jun 6, 2012, 10:06:46 PM6/6/12
to stan...@googlegroups.com
It seems now that when the number of chains is 1, 
this function would return the number of iterations. 

If I add the following to the end of section effective_sample_size in
stan/src/test/mcmc/chains_test.cpp
(the change is not pushed)

  stan::mcmc::chains<> c1(1, names, dimss);
  add_chain(c1, 0, "src/test/mcmc/test_csv_files/blocker1.csv", 2);
  idxs.clear();
  idxs.push_back(0);
  index = c1.get_total_param_index(c1.param_name_to_index("mu"),
                                   idxs);
  EXPECT_GT(c1.num_samples(), c1.effective_sample_size(index));

Then I would end up with

[ RUN      ] McmcChains.effective_sample_size
src/test/mcmc/chains_test.cpp:1039: Failure
Expected: (c1.num_samples()) > (c1.effective_sample_size(index)), actual: 1000 vs 1000
[  FAILED  ] McmcChains.effective_sample_size (57 ms)


--
Jiqiang

Andrew Gelman

unread,
Jun 6, 2012, 10:31:51 PM6/6/12
to stan...@googlegroups.com
That shouldn't be! Even when number of chains=1, we still split into 2 parts for split-Rhat and effective sample size, so we should get something reasonable based on these 2 chains.
A

On Jun 6, 2012, at 10:06 PM, Jiqiang Guo wrote:

> It seems now that when the number of chains is 1,
> this function would return the number of iterations.
> Jiqiang

Jiqiang Guo

unread,
Jun 26, 2012, 4:08:03 PM6/26/12
to stan...@googlegroups.com
I saw a change on the implementation.  But I am still having 
this issue when the # of chains is 1. 

--
Jiqiang 
Reply all
Reply to author
Forward
0 new messages