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

add a function to sample from posterior #70

Closed
annecori opened this issue May 29, 2019 · 1 comment · Fixed by #76
Closed

add a function to sample from posterior #70

annecori opened this issue May 29, 2019 · 1 comment · Fixed by #76
Assignees

Comments

@annecori
Copy link
Collaborator

annecori commented May 29, 2019

sample_posterior_R <- function(R, n_simul = 1000)
{
mu <- R$R$`Mean(R)`
sigma <- R$R$`Std(R)`
Rshapescale <- epitrix::gamma_mucv2shapescale(mu = mu, cv = sigma / mu)
rgamma(n_simul, shape = Rshapescale$shape, scale = Rshapescale$scale)
}
@annecori annecori self-assigned this May 29, 2019
@zkamvar
Copy link
Collaborator

zkamvar commented Jun 6, 2019

Given that epitrix::gamma_mucv2shapescale() looks like this:

epitrix::gamma_mucv2shapescale
#> function (mu, cv) 
#> {
#>     shape <- 1/(cv^2)
#>     scale <- mu * cv^2
#>     return(list(shape = shape, scale = scale))
#> }
#> <bytecode: 0x5629fdc76470>
#> <environment: namespace:epitrix>

I would suggest that we use this formulation instead of importing epitrix.

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

Successfully merging a pull request may close this issue.

2 participants