xfim / ggmcmc

Graphical tools for analyzing Markov Chain Monte Carlo simulations from Bayesian inference
111 stars 31 forks source link

Cannot include the warmup using ggs for a stanfit object #40

Closed perkaer closed 9 years ago

perkaer commented 9 years ago

Hi there

When I run the following command, I cant seem to get out the warmup samples..

But I guess this is the idea with inc_warmup = T?

> ggs(STAN_fit, family = 'sigma', inc_warmup = T)
Source: local data frame [1,000 x 4]

   Iteration Chain          Parameter    value
1          1     1 transactions_sigma 208765.6
2          2     1 transactions_sigma 206573.2
3          3     1 transactions_sigma 198310.6
4          4     1 transactions_sigma 214327.9
5          5     1 transactions_sigma 209830.3
6          6     1 transactions_sigma 205860.9
7          7     1 transactions_sigma 199150.3
8          8     1 transactions_sigma 209000.2
9          9     1 transactions_sigma 200834.9
10        10     1 transactions_sigma 217648.9
..       ...   ...                ...      ...
Warning message:
In ggs(STAN_fit, family = "sigma", inc_warmup = T) :
  inc_warmup must be 'FALSE', so it is ignored.
xfim commented 9 years ago

To be honest, I can't remember why I added an "inc_warmup" argument at some point, because stan() does not seem to allow getting the warmup samples, and therefore this argument is useless. Maybe it did it in a former version, but now it is not possible to store warmup samples. Therefore, this argument is useless right now.

What were you expecting as behaviour when setting it to TRUE?

If it were possible to keep warmup samples from stan() I would keep the function, but otherwise (and unless you provide a reasonable expected behaviour) I will delete it.

perkaer commented 9 years ago

Thx for your answer.

I am pretty sure stan returns all samples, both warmup and real samples, and you cannot disable it afaik. Both rstan::extract and rstan::traceplot have inc_warmup arguments, which include warmup samples in their output.

When setting inc_warmup=TRUE, I simply expected to be able to do all the nice things ggmcmc does, but including warmup sample :) But more specifically I just want traceplots including warmup samples, to see how many warmup samples I typically need.

Thx for a great piece of software.

xfim commented 9 years ago

After fighting a bit with the stanfit class, I have been able to extract the warmup samples, without using rstan::extract. In addition, the solution has forced me to rewrithe the stanfit extraction, which I think is more efficient now. Done at 3508210.

Please test it and check that it works.

Thank you for your kind words.

perkaer commented 9 years ago

The burnin samples are indeed included in the traceplot now.

Thanks a lot :)