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

mcmc_recover_intervals extensions - bias + coverage #63

Open
wds15 opened this issue Jan 3, 2017 · 9 comments
Open

mcmc_recover_intervals extensions - bias + coverage #63

wds15 opened this issue Jan 3, 2017 · 9 comments
Labels

Comments

@wds15
Copy link

wds15 commented Jan 3, 2017

Hi!

I just discovered the intervals function which looks great! I know that I should put all of my parameters one the unit-scale, but in practice I sometimes don't do that (even thought I should, I know). For these circumstances it would be nice to plot things as bias. So instead of showing the true values along with the intervals I would like to see an option which would allow me plot the bias.

Of course, the concept of bias is shaky in a Bayesian world, but as long as I can be sure that my prior is weakly-informative, I would like to be able to do that.

Another very useful extensions (I am happy to open another issue) would be a plot of the coverage when I replicate things a lot of times.

BTW, these tools look awesome to me!

@bob-carpenter
Copy link
Member

bob-carpenter commented Jan 3, 2017 via email

@betanalpha
Copy link

betanalpha commented Jan 3, 2017 via email

@jgabry jgabry added the feature label Jan 4, 2017
@wds15
Copy link
Author

wds15 commented Jan 24, 2017

Hi!

Ok, getting the bias is simple using what is there like this:

library(rstanarm)
alpha <- 1; beta <- c(-.5, .5); sigma <- 2
X <- matrix(rnorm(200), 100, 2)
y <- rnorm(100, mean = c(alpha + X %*% beta), sd = sigma)
fit <- stan_glm(y ~ X)
draws <- as.matrix(fit)
print(colnames(draws))
true <- c(alpha, beta, sigma)
mcmc_recover_intervals(draws, true)

draws_bias <- sweep(draws, 2, true)
mcmc_recover_intervals(draws_bias, rep(0, 4))

that gives me what I want for the bias. Let's see if I figure out the coverage. BTW, the package is awesome!

@jgabry
Copy link
Member

jgabry commented Jan 24, 2017 via email

@wds15
Copy link
Author

wds15 commented Jan 25, 2017

This is so simple that we could just include it as an example in the documentation maybe? What I have done is just a good use of what is there, so I am not sure if you really want to make this part of bayesplot as you need to maintain it. The gain of including it explicitly is that you encourage people to look at the their problems in this viewangle more likely as the option is more prominent. Up to you to decide.

@jgabry
Copy link
Member

jgabry commented Jan 25, 2017 via email

@wds15
Copy link
Author

wds15 commented Feb 6, 2017

So we got the bias in now which leaves the coverage. For that one would need multiple posteriors each coming from an independent fit of (usually) fake data. I am not sure of the "batch" concept is exactly that or is it?

@jgabry
Copy link
Member

jgabry commented Feb 6, 2017 via email

@wds15
Copy link
Author

wds15 commented Feb 8, 2017

I thought so. Should we then close this issue as it seems out of scope?

However, I do have to say that I have done such experiments, i.e. repeated fake-data simulations and then look at the coverage and correlation in the bias. Both of which were very interesting to learn about in the model as it did tell me a new aspect of my model how it performs under repetition. A correlated bias and the coverage is something one wants to know, I think; would be curious what others think. Possibly worth to discuss in a Stan meeting?

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

No branches or pull requests

4 participants