i have obtained samples from posterior distribution using normal prior,
now i want to form a custom function that takes - target prior as input multiplied with posterior samples divided by normal prior that was used for generation of posterior samples.
Using the above new custom function i want to again sample new posterior distribution. How to do this?
- How to know the prior used by pymc3 algorithm for computing posterior samples.
The prior for the model parameters will be a normal distribution
family = pm.glm.families.Normal()
# Creating the model requires a formula and data (and optionally a family)
pm.GLM.from_formula(formula, data = X_train, family = family)
# kwargs = dict(target_accept=.8)
# Perform Markov Chain Monte Carlo sampling
normal_trace = pm.sample(draws=1000, tune = 1000, target_accept = 0.8, init = "auto")
i have used the above code to generate posterior samples.