Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regression using PYMC3

I posted a IPython notebook here http://nbviewer.ipython.org/gist/dartdog/9008026

And I worked through both standard Statsmodels OLS and then similar with PYMC3 with the data provided via Pandas, that part works great by the way.

I can't see how to get the more standard parameters out of PYMC3? The examples seem to just use OLS to plot the base regression line. It seems that the PYMC3 model data should be able to give the parameters for the regression line? in addition to the probable traces,, ie what is the highest probability line?

Any further explanation of interpretation of Alpha, beta and sigma welcomed!

Also how to use PYMC3 model to estimate a future value of y given a new x ie prediction with some probability?

And lastly PYMC3 has a newish GLM wrapper which I tried and it seemed to get messed up? (it could well be me though)

like image 276
dartdog Avatar asked Feb 14 '14 20:02

dartdog


1 Answers

The glm submodule sets some default priors which might very well not be appropriate for every case of which yours is one. You can change them by using the family argument, e.g.:

pm.glm.glm('y ~ x', data,
           family=pm.glm.families.Normal(priors={'sd': ('sigma', pm.Uniform.dist(0, 12000))}))

Unfortunately this isn't very well documented yet and requires some good examples.

like image 194
twiecki Avatar answered Sep 24 '22 04:09

twiecki