Created
December 8, 2021 17:33
-
-
Save jdmoore7/103f3fa31c13108281eea56b3d2d5a29 to your computer and use it in GitHub Desktop.
Bayesian linear model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymc3 as pm | |
with pm.Model() as model: | |
m = pm.Normal('m',mu=0, sd=2) | |
b = pm.Normal('b',mu=0, sd=2) | |
s = pm.Exponential('s',lam=1) | |
y_hat = pm.math.dot(m, X) + b | |
lik = pm.Normal('lik', mu=y_hat, observed=pm.math.log(Y), sigma=s) | |
trace = pm.sample(chains=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment