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

How to sample from the posterior? #35

Open
garyzhubc opened this issue Jul 20, 2023 · 2 comments
Open

How to sample from the posterior? #35

garyzhubc opened this issue Jul 20, 2023 · 2 comments

Comments

@garyzhubc
Copy link

How to sample from the posterior?

@pcarbo
Copy link
Owner

pcarbo commented Jul 20, 2023

@garyzhubc The code for function varbvspve illustrates how to do this.

@garyzhubc
Copy link
Author

I'm seeing this loop

  pve <- rep(0, nr)
  for (i in 1:nr) {
    j <- sample(ns, 1, prob = fit$w)
    b <- with(fit, mu[, j] + sqrt(s[, j]) * rnorm(p))
    b <- b * (runif(p) < fit$alpha[, j])
    sz <- c(var1(X %*% b))
    pve[i] <- sz/(sz + fit$sigma[j])
  }

Is b here a posterior sample of inclusion?

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

2 participants