Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem if number of observations exceeds number of chains x number of samples #50

Open
schwa021 opened this issue May 23, 2018 · 0 comments

Comments

@schwa021
Copy link

Hi Brian,

Thanks for the amazing code. MatlabStan has been absolutely wonderful to use.

I discovered (and solved) a very minor bug. I deal with fairly large data sets. If my number of observations exceeds number of chains x number of samples, then the fit.extract method fails.

I tracked down the issue, and it is an easy fix. in mcmc.m you set a size variable (sz) as:

           sz = size(temp);

you then use this in the subsequent line:

            temp = temp(self.permute_index(1:max(sz)),:);

But, when nobservations>nchains*nsamples, this crashes since max(sz) no longer applies to the proper index.

The trivially easy fix is to replace max(sz) with sz(1).

          temp = temp(self.permute_index(1:sz(1)),:);

Probably very few people run into this bug. However, if/when you release an update, it is an easy change to make.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant